I'm using authlib with the following code:
session = OAuth2Session(client_id, client_secret)
token = session.fetch_access_token(
access_token_url,
client_id='.....',
method='POST',
client_secret=client_secret,
authorization_response=request.url,
code=request.args['code']
)
Which yelds a requests.exceptions.SSLError (CERTIFICATE_VERIFY_FAILED) when trying to access to my own OAuth2 server with self-signed certificates.
What should I do to use HTTPS regardless of this error ?
There are two ways:
verify=False
, which won't validate the SSLOAuth2Session.fetch_access_token
accepts all parameters supported by requests. Check requests API documentation: https://2.python-requests.org/en/master/api/#requests.request