microsoftgraph-python icon indicating copy to clipboard operation
microsoftgraph-python copied to clipboard

Flow for signing in user and getting "code"

Open leinad9905 opened this issue 3 years ago • 2 comments

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

leinad9905 avatar Aug 24 '22 16:08 leinad9905

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.

cormac-everhaze avatar Sep 07 '22 17:09 cormac-everhaze

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

drizta95 avatar Sep 22 '22 08:09 drizta95

Sorry for the late response.

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

ingmferrer avatar Jan 30 '23 15:01 ingmferrer