Questions tagged [authlib]
The authlib tag has no usage guidance.
146
questions
0
votes
0
answers
14
views
ModuleNotFoundError - API Access Using Python
I'm working on accessing Apple Search Ads API and currently having trouble in step: "Create A Client Secret" due to two "ModuleNotFoundError" errors.
I've already installed the ...
0
votes
0
answers
83
views
Python-Authlib: setting an Oauth2 Async client with (service principal) and (user, password)
I come here for help after being stuck a few hours creating an OAuth2 Async httpx client.
It's one of those situations that feels so close, and still doesn't come through in the end.
I'm using this ...
0
votes
1
answer
53
views
Error code 215 when authenticating Twitter API 2.0 in Python using Authlib and OAuth2
I've seen lots of related questions to this one, but none of the answers have helped me.
First, I went to the Twitter Developer Portal and set up my OAuth2.0 Client ID and Secret:
Then, I used ...
0
votes
0
answers
108
views
Missing "nonce" claim with Quickbooks + Authlib
When I try to implement an OAuth flow into Quickbooks Online with the openid scope, I receive an error authlib.jose.errors.MissingClaimError: missing_claim: Missing "nonce" claim.
Here is ...
1
vote
0
answers
253
views
How to disable SSL verification for OAuth client of Authlib Python library?
I'm using Python 3.9.12 on Windows 10. My goal is to connect to KeyCloak server through browser to fetch access token. I'm using Authlib 0.15.5 to connect to the server to fetch the authentication URL....
0
votes
0
answers
32
views
Is there an example-oauth2-server repo for jwt access token instead of opaque?
This repo https://github.com/authlib/example-oauth2-server is amazing. But there is very little flexibility.
Is there any repo existing that creates an OAuth Authorization Server to deliver a JWT ...
0
votes
1
answer
95
views
Python Authlib: 'View' object has no attribute 'get_absolute_uri'
I am adding OAuth 2.0 to a new Django-DRF API via Auth0 using Authlib. Everything has always worked fine using a function-based views however when I try to apply the authlib ResourceProtector ...
0
votes
0
answers
240
views
Authlib OAuth2Session: Is it possible to `fetch_token` with a JSON POST body instead of URL params?
I have an Authlib OAuth2Session and I am trying to authenticate with username and password. Here's what I am doing:
self.session = OAuth2Session(
token_endpont=f"{API_URL}/oauth/token",
)...
0
votes
1
answer
107
views
Redirecting broken after authorizing using Authlib
I am currently trying to get Authlib to work with an existing flask app on Openshift. I am using a company SSO provider that handles the login.
Here is the configuration for Authlib:
from authlib....
0
votes
1
answer
251
views
authlib.jose.errors.InvalidClaimError: invalid_claim: Invalid claim "iss"
I'm building an oauth2 client with Flask and Authlib. My code to register the oauth is:
google = oauth.register(
name='google',
client_id='',
client_secret="",
...
1
vote
0
answers
68
views
Authlib Securing Login Endpoint and Passing Identity to Authorized Endpoint
I am trying to use Python's Authlib package. For that I am defining a login endpoint and an authorized redirect endpoint. I am trying to secure the login endpoint, verify identity and pass it to the ...
0
votes
1
answer
2k
views
Google login for FastAPI
I am using the code below for google authentication. There is two end points (/login and /auth). At the first time I can sign in with my google account but when I want to change it, it does not ask me ...
0
votes
2
answers
58
views
Authlib module not found on bmc control-m
I am running a code with uses authlib module and it runs fine with all dependency met but when I try to automate it through bmc control-m it gives module not found error. Any help would be really ...
0
votes
1
answer
154
views
oauth 1 not working with httpx and authlib
i am currently making oauth 1 signed requests using the requests-oauthlib library.
from requests_oauthlib import OAuth1Session
self.session = OAuth1Session(
OAUTH_CONSUMER_KEY, ...
0
votes
1
answer
351
views
Getting handshake error while doing Oauth 2.0 flow with IdentityServer4 and Authlib
I have implemented an authorization server using IdentityServer4 and also a client app using Python Flask and try to test authentication with Authlib. I managed to get past the error one by one but ...
0
votes
0
answers
227
views
Redirect after logging in with authlib
I've used Authlib as part of a Django application to allow users to sign in with their Google account. After the user has signed in, I'd like to redirect users to the page they were originally on. The ...
0
votes
1
answer
108
views
TypeError: 'ResourceProtector' object is not callable
According to the Authlib documentation, there is a built-in approach to use introspection endpoint to validate the given token when resource server has no access to token database:
import requests
...
1
vote
1
answer
948
views
RuntimeError: Missing "jwks_uri" in metadata for flask and Azure AD authlib
I tried login in via Azure AD in airflow container.
I setting de webserver_config.py
OAUTH_PROVIDERS = [
{
'name':'azure', 'token_key':'access_token', 'icon':'fa-windows',
'...
0
votes
2
answers
391
views
Airflow 2.2.5 Authlib 1.0.0 Google Login
I'm experiencing problems with Google OAUTH login after updating Airflow to version 2.2.5 and Authlib required as constraint to be at version 1.0.0.
Here my previous webserver_config.py
import os
from ...
2
votes
1
answer
272
views
Python-Youtube-Api : Missing code parameter in response
I am testing the python-youtube package, using the following code:
from pyyoutube import Api
api = Api(
client_id="yes-my-client-id-here-i-know",
client_secret="yes-my-client-...
1
vote
0
answers
980
views
How to setup a Bearer Token Authentication in AsyncOAuth2Client with authlib
I'm calling an API that has a bearer token authentication.
With regular requests package I have successfully implemented it, but then I had to upgrade the class to run concurrent requests.
I found ...
5
votes
1
answer
2k
views
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 ...
0
votes
1
answer
168
views
creating event gives 400 bad request - Google calendar API using AUTHLIB (Python package)
This is my request to create an event (Using AuthLib from PyPi)
resp = google.post(
'https://www.googleapis.com/calendar/v3/calendars/primary/events', data={
'start': {'dateTime': today....
0
votes
1
answer
560
views
Implementing Introspection Validation from Okta using Authlib in Python Flask App
I am trying to implement introspection on client side suing Okta as my authorization server but continuously getting error
{"error": "missing_authorization", "...
4
votes
1
answer
556
views
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 ...
3
votes
1
answer
567
views
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 ...
0
votes
1
answer
438
views
Why is the redirect_uri of my gitlab as an OAuth2 provider http instead of https?
I want to configure my deployment of superset so that users can signing using gitlab as OAuth2 provider.
Superset is a flask app that uses authlib to enable OAuth2 (https://superset.apache.org/docs/...
0
votes
1
answer
709
views
How to configure Keycloak for Superset with Authlib?
I'm trying to use Authlib to setup Keycloak as SSO for Superset. Everything works fine up until when user is redirected back to Superset. Then this error occured:
authlib.integrations.base_client....
1
vote
1
answer
1k
views
How to turn off SSL verification for Authlib client with HTTPX / Starlette?
I can't seem to find a way to make Authlib / HTTPS respect the self-signed certs no matter how hard I try, so I want to turn SSL verification off when making requests as the OAuth client. How can I do ...
6
votes
0
answers
1k
views
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.
...
0
votes
0
answers
152
views
Problem while implementing my own OpenID provider and client
I am using authlib library(python) which is for client side and Oauth2 for the serverside.
after resp = oauth.get('userinfo') step my client side code stops and I get this error shown in the browser:
{...
1
vote
1
answer
1k
views
OAuth2 Session - How to add multiple scopes?
I am trying to add multiple scopes but it seems instead of adding spaces in the url, it adds +. I'm not sure how to ensure a space is added. I'm storing the scopes in a list.
CALLBACK_URL = 'https://...
2
votes
0
answers
633
views
Authlib Flask Client - How to validate and refresh the access token
I have been trying to integrate Authlib Flask Client to achieve the OIDC via Google OIDC. I am using Flask SQLAlchemy, and everything is working perfectly fine. The only problem is I am unable to ...
1
vote
1
answer
2k
views
401 Client Error: Unauthorized url. Flask python
I have a program that Authenticate with API and when logged in search by Id in contacts on this API.
logging in works fine but when I try to find contact this error happen:
401 Client Error: ...
1
vote
2
answers
1k
views
Does authorize_access_token also verify an id token?
For retrieving an OAuth / OpenID Connect token, the function authorize_access_token is used in the authlib docs. OAuth providers like Google strongly advise to manually verify these tokens, for ...
0
votes
0
answers
177
views
Python Import Error : Unable to to import JWTBearerToken from authlib.oauth2.rfc7523
I am trying to use JWTBearerToken from authlib.oauth2.rfc7523. However, I have encountered import error when trying to import JWTBearerToken:
Create a virtual environment and install authlib
$ pyenv ...
0
votes
1
answer
486
views
authlib.integrations.base_client.errors.MismatchingStateError
Trying to get a token for tradestation with flask_client.
baseurl='https://sim-api.tradestation.com/v2'
oauth.register(
name='tradestation',
client_id=api_key,
client_secret=api_secret,
...
0
votes
1
answer
689
views
Examples of using authlib's httpx client asynchronously
There are several examples here of using an httpx client instead of a requests based session with the popular oauth lib, authlib
However in those examples, they don't show how to properly open and ...
3
votes
0
answers
819
views
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 ...
1
vote
1
answer
220
views
How to add custom Header in Authlib on Django
I would need some of your help adapting Authlib with Django.
I'm trying to develop a Django app using OpenId and Authlib to connect my users and facing an issue with the access token, the issue ...
0
votes
1
answer
175
views
What is the API contract for OAuth2Session update_token callback?
The OAuth 2 client documentation on refresh & autoupdate token is unclear on the semantics for the various parameters.
When are refresh_token & access_token passed in?
What are their values ...
1
vote
0
answers
256
views
Authlib - Oauth2 Server - how to accept json client credentials?
I'm doing an integration with a company, and have little control over their client side. code In this case, I have to implement an Oauth2 server and support their specific integration. They want to ...
0
votes
1
answer
842
views
Authlib Token Validator using Remote Authentication Server
The Authlib documentation describes how a resource server can validate the auth_token from the client implementing a BearerTokenValidator as such:
class MyBearerTokenValidator(BearerTokenValidator)...
1
vote
1
answer
334
views
Python AuthLib Resource Server using a BearerTokenValidator with Multiple Strategies
I have a resource server (built with Flask, but not sure if that matters right now) that has a RESTful API. The API is secured with OAuth2 access tokens and scopes.
Currently the access tokens are ...
0
votes
1
answer
869
views
In authlib, does authorize_access_token require the explicit passing of client_id and client_secret?
I am using authlib with a pretty standard OAuth2 flow.
import pickle
import json
import os.path
from requests.models import Response
from authlib.integrations.flask_client import OAuth, OAuthError
...
0
votes
1
answer
280
views
How can I send Authlib requests through a proxy?
With requests I can make a request through a proxy:
import requests
proxies = {
"http": "http://proxy.yourorg.com:80",
"https": "http://proxy.yourorg.com:80&...
0
votes
0
answers
457
views
Authlib: json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
I'm using this blog post from Authlib's blog to add google oauth to a FastAPI app. I'm from Iran and Everything works fine when my VPN is on, but when it's off and I try to login to app with google ...
0
votes
1
answer
317
views
Python requests authlib - SSLCertVerificationError CERTIFICATE_VERIFY_FAILED
How to make Autlib/ requests work with self signed certificates on Windows?
There is documentation for how to use an environment variable to point to a CA bundle, but in my case I have struggled to ...
1
vote
1
answer
1k
views
Python authlib flask - how to revoke token / logout
In my current situation my flask app could be the only one using the Oauth server.
In that case I'd like to have my logout button actually revoke the access token.
But how to do that using the authlib ...
1
vote
1
answer
491
views
Authlib's Azure login throws an invalid_claim: Invalid claim "iss"
I am currently login with Google with no problems, using Authlib for my Starlette app, but Azure throws this invalid claim "iss" error when doing:
await client.parse_id_token(request, token)
...