I am trying to setup a flask server because the underlying library outlined in oktas guide is abandoned and has security problems.
So I found a supported library called authlib with flask support.
Here’s how I instance the library
from authlib.integrations.flask_client import OAuth
oauth = OAuth(app)
oauth.register(
name='oidc_client',#'okta',
client_id='xxxx',
client_secret='yyyyyyyyyy',
request_token_url='https://dev-1.okta.com/oauth2/default/v1/token',
access_token_url='https://dev-1.okta.com/oauth2/default/v1/token',
#access_token_url='https://dev-1.okta.com/oauth2/default/v1/authorize', # i tried this too
authorize_url='https://dev-1.okta.com/oauth2/default/v1/authorize',
api_base_url='https://dev-1.okta.com/oauth2/',
)
The problem happens when I try to authenticate I get this error:
authlib.integrations.base_client.errors.OAuthError: fetch_token_denied: Token request failed with code 400, response was ‘{“errorCode”:“E0000021”,“errorSummary”:“Bad request. Accept and/or Content-Type headers likely do not match supported values.”,“errorLink”:“E0000021”,“errorId”:“oaeHlsSPdOrQ-K0_5iOT0nnhA”,“errorCauses”:}’.
Any ideas? Are there overrides I can set to fix the header? Is it related to this? ```