So, after some exchanges, test, ..., even I do not still connected to my sharepoint, my understanding is
Sharepoint have 2 APIs
- API v1 : Accessing by ??
- API v2 : Accessing by MS Graph
- Request an accessToken to MS Graph
- Request for SP API to MS Grpah (with our accessToken)
- MS Graph transfert the request to SP API v2 (with its own accessToken)
The old way : Using SharePoint REST API V1
- This is an old way using SharePoint REST API V1
- The follow point is right (only for SP v1 API)
If you try to use an app-only access token obtained using client id and client secret, SharePoint Online will return the following error: Unsupported app only token.
- I tried to build an JWT, ... but I left this way for the next
The new way : Using MS Graph (SP v2 API)
- This is a new way using selected MS Graph endpoints (AKA SharePoint REST API V2)
- We can use Client id/secret methode to acquiring access tokens for APIs
- For the accessToken request, we have to use the Scope : https://graph.microsoft.com/.default
- Now, I got a new error
{
"error":{
"code":"AccessDenied",
"message":"Either scp or roles claim need to be present in the token.",
"innerError":{
"date":"2023-09-25T07:56:11",
"request-id":"f043a5d1-f03b-41c5-a482-2cd5ffd6ba49",
"client-request-id":"f043a5d1-f03b-41c5-a482-2cd5ffd6ba49"
}
}
}
But maybe it's not any more the same issue as first, so maybe, this issue can be closed.