I solved the problem with microsoft now, here is the report:
Initial Observation:
We connected with the customer over a call to troubleshoot the issue.
During the call, we observed that the configuration of the HTTP action, specifically while generating the bearer token from the Graph API, was incorrect. The body parameters were passed in an incorrect format, resulting in an incompatible bearer token.
Reconfiguration of Bearer Token Generation:
Steps involved in generating the bearer token:
Configure the HTTP Action:
Set the method to POST.
In the URI field, enter the token endpoint URL. For Microsoft Graph, it typically looks like this: https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token.
In the Headers section, add the following key-value pair:
Content-Type: application/x-www-form-urlencoded
In the Body section, add the following parameters in the form of key-value pairs:
client_id: Your application's client ID.
scope: https://graph.microsoft.com/.default
client_secret: Your application's client secret.
grant_type: client_credentials
Parse the JSON Response:
Added a "Parse JSON" action to parse the response from the HTTP action.
In the Content field, select the body of the HTTP response.
In the Schema field, we provided the following content:
{
"properties": {
"access_token": {
"type": "string"
},
"expires_in": {
"type": "integer"
},
"ext_expires_in": {
"type": "integer"
},
"token_type": {
"type": "string"
}
},
"type": "object"
}
Using the Bearer Token for SharePoint API Authentication:
Now that we have the bearer token, in the subsequent HTTP action to call the SharePoint Graph API, we added the following key-value pair in the Headers section:
Authorization: Bearer @{body('Parse_JSON')?['access_token']}
This action was successful, confirming that the bearer token was valid and correctly configured.