I checked here One Note Api rejects Bearer Token, Error 401. and my scopes are good.
For step 2 of code flow my "Scopes" say office.onenote office.onenote_create office.onenote_update_by_app office.onenote_update wl.offline_access
when receiving the access_token
so I take the access_token
and do a requests
headers={"Authorization" : "Bearer " + x['access_token'], 'Accept': 'application/json'}
r=requests.get( url=url,data = headers)
r.status_code=401
I earlier used the same requests
command for a Token flow to get the access_token
and it worked fine.
You should use the headers
argument to set the headers :
r=requests.get(url=url, headers=headers)
The data
argument is used to send post data in post requests.