Questions tagged [authlib]

160 questions
8
votes
2 answers

Python OAuth2 server with social networks for a RESTfull API

I'm trying to implement OAuth2 server for a RESTfull API with a login option through social platforms (Github, Facebook, Instagram) using Python and Falcon web framework. But I've struggled to understand how this thing should work. My current…
Vit D
  • 193
  • 1
  • 7
  • 25
7
votes
0 answers

Starlette session state clearing

some strange behaviour I've found when trying to clear Starlette sessions state (using starlette.middleware.sessions.SessionMiddleware) while working through some OAuth/0Auth authentication examples. In Flask, the following session clearing code on…
Dmytro Bugayev
  • 606
  • 9
  • 13
6
votes
1 answer

Which Timed JSONWebSignature Serializer replacement for itsdangerous is better? pyjwt or authlib

Currently I was using itsdangerous to generate timed json web signature as a token for users to auth and resetpassword etc. Here's the code: from itsdangerous import TimedJSONWebSignatureSerializer as Serializer class SampleCode: def…
Justin Lee
  • 800
  • 1
  • 11
  • 22
6
votes
3 answers

MismatchingStateError: mismatching_state: CSRF Warning! State not equal in request and response

This is driving me absolutely crazy and preventing me from being able to do local dev/test. I have a flask app that uses authlib (client capabilities only). When a user hits my home page, my flask backend redirects them to /login which in turn…
adamcunnington
  • 292
  • 1
  • 3
  • 16
6
votes
1 answer

Flask-oauthlib or authlib in production?

I just got flask-oauthlib working in a website I'm building. However, I noticed that the front page of the project has a warning to use authlib instead. If you use flask-oauthlib in production are you planning to migrate to authlib? Is anyone aware…
ukosteopath
  • 443
  • 7
  • 14
5
votes
1 answer

How to save and reuse tokens with authlib

I'm very beginner with authlib and trying to understand its concepts. I try to understand, how can I save and reuse fetched tokens with authlib. I created small FastAPI project: from fastapi import FastAPI from starlette.config import Config from…
catscoolzhyk
  • 675
  • 10
  • 29
4
votes
1 answer

Better examples of authlib OAuth client use with a Flask app?

I have got both the password and code grant flows working with my Flask app, but it all feels a bit clunky. I find the use of fetch_token and update_token in oauth.register to handle token timeout quite confusing, and I have found no examples of…
Alias_Knagg
  • 886
  • 1
  • 7
  • 21
4
votes
1 answer

Authlib client error: State not equal in request and response

I'm trying to implement authlib client and server. I took example OAuth2.0 example and making my own client authorization on Flask site following tutorial. This is my code: from flask import Flask, redirect, url_for, session, request from…
Mikhail Kashkin
  • 1,521
  • 14
  • 29
4
votes
0 answers

Migration guide flask-oauthlib to authlib

I'm trying to migrate a legacy app that uses Flask-OAuth to authlib. The documentation of authlib is fairly decent, but what would be helpful is a migration guide, because I don't really know what parts of flask-oauthlib are similar to parts of…
James O'Brien
  • 1,696
  • 1
  • 13
  • 10
3
votes
1 answer

mismatching_state: CSRF Warning! State not equal in request and response in fastapi

I am trying to integrate gitlab in my fastapi project however, this problem is killing me. I am using authlib for it. The process of gitlab integration is when a user hits a connect button then gitlab authorization window pops up where when…
milan
  • 2,409
  • 2
  • 34
  • 71
3
votes
0 answers

Python Authlib : How To Resolve Auth Code Challenge And Verify Tokens Stored In HTTP Only Session Cookie Of Protected Endpoint?

After reading the documentation I am struggling to understand how to use Authlib to implement Authorize Code Flow for an OpenID Connect provider. After reading the documentation I have had a go at implementing the following code listed below. The…
anon_dcs3spp
  • 2,342
  • 2
  • 28
  • 62
3
votes
1 answer

Obtaining and storing refresh token using Authlib with flask

I'm using the authlib https://github.com/lepture/authlib obtain user authentication to their data, so a daily offline scheduler can download some data on the behalf of the user. I first register the client: google = oauth.register( 'google', …
Sharethefun
  • 804
  • 3
  • 17
  • 33
3
votes
1 answer

ImportError: cannot import name 'bytes_type' from 'oauthlib.common'

I am updating airflow from 1.10.5 to 1.10.10. I am getting the following error in webserver when using google OAuth Traceback (most recent call last): File "/home/airflow/.local/bin/airflow", line 37, in args.func(args) File…
Ayush Chauhan
  • 441
  • 7
  • 25
3
votes
1 answer

Could we make OAuth2Session refresh token x seconds before it expires?

This question relates to authlib python module: I'm using an authlib OAuth2Session to trigger a lot of requests to an API. I provided a refresh_token_url to my OAuth2Session, so that the access_token is seamlessly refreshed when expired. Most of the…
Géraud
  • 1,923
  • 3
  • 20
  • 20
3
votes
1 answer

Python 3.7 Authlib UnsupportedAlgorithmError

I have this issue on Ubuntu 18.04 in the Docker. When I develop this app on macOS there is no such error. I build image with this Dockerfile: https://pastebin.com/rG32a0dv requirements.txt:…
andre487
  • 1,261
  • 2
  • 18
  • 27
1
2 3
10 11