How to get authorization code from redirect URI Python?
Get access token from authorization code Python
OAuth is an open-source & secure protocol for authorizing users between unrelated services. It is used in different types of applications but is most commonly used in web, mobile, and desktop applications.

from oauthlib.oauth2 import WebApplicationClient client_id = 'xxxxx' client = WebApplicationClient(client_id)
Step2: Fetch Access Token
data = client.prepare_request_body( code = 'yyyyy', redirect_uri = 'https://example-app.com/redirect', client_id = 'xxxxx', client_secret = 'zzzzz' )
Step3: Obtain User Info
header = { 'Authorization': 'Bearer {}'.format(client.token['access_token']) } response = requests.get('https://api.resource-server.com/user', headers=header)