GearPlug / microsoftgraph-python

Microsoft Graph API wrapper written in Python
MIT License
96 stars 40 forks source link

Flow for signing in user and getting "code" #38

Closed leinad9905 closed 1 year ago

leinad9905 commented 2 years ago

Hey there, with this flow, what step do you recommend to pass "code" to exchange code for access token. I understand the user would login in the browser. Sorry if the question is low level, still learning more about Graph API

cormac-everhaze commented 2 years ago

When the user visits the url that comes from url = client.authorization_url(redirect_uri, scope, state=None), you should see the key "code" is passed to your callaback view.

Then just pass the code value into client.exchange_code(redirect_uri, code) and you will get an access token for that user.

drizta95 commented 2 years ago

Hi! If in the response I am just getting <Response [200]>, how can I set the token?

ingmferrer commented 1 year ago

Sorry for the late response.

You should be able to access it with .data property.