I've read lots of docs and different posts, but I can't get the right access token to read my own OneNote via api.
BUT:
https://login.microsoftonline.com/{tried 'common' or my tenant_id here}/oauth2/v2.0/token
,
then it does not work:The OAuth token provided does not have the necessary scopes to complete the request. Please make sure you are including one or more of the following scopes: Notes.ReadWrite.All,Notes.Read.All
token_request_data = {
'client_id': 'id from my app', # also tried 'common'
'scope': 'https://graph.microsoft.com/.default', # other scopes cause errors
'client_secret': 'secret from my app',
'grant_type': 'client_credentials'
}
Perhaps somebody could give me a clue what I'm doing wrong ? :)
Sample request via graph explorer:
https://graph.microsoft.com/v1.0/users/{my_username}@outlook.com/onenote/sections
Notes.Read.All
and Notes.readWrite.All
are valid for Work or school accounts only. Please refer this document.