It about ms team app js auth token
I did my project in laravel and graph api so it works fine.
but now i already created MS team app and authenticate using msteam.js lib this is also works well, i am able to generate access_token using library,.
Main problem is : I am unable to validate that token using this below code. So how can i authenticate that token ?
Request:
$accessToken=$request->token;
$graph = new Graph();
$graph->setAccessToken($accessToken);
$graph_user = $graph->createRequest("GET", "/me")->setReturnType(Model\User::class)->execute();
Response:
Client error: `GET https://graph.microsoft.com/v1.0/me` resulted in a `401 Unauthorized` response:
Response is:
Client error: `GET https://graph.microsoft.com/v1.0/me` resulted in a `401 Unauthorized` "message":"Access token validation failure. Invalid audience."
Thank you very much!
Microsoft Security | Microsoft Graph
2 answers
Sort by: Most helpful
-
-
CarlZhao-MSFT 46,406 Reputation points2023-08-22T09:09:23.1366667+00:00 Hi @Smithiam
The audience of this token seems to be Web API instead of graph API, so this token can only be used to call your custom Web API.
But I noticed that your script is using the graph SDK, so try to get an access token for the graph API:
'scope' => 'https://graph.microsoft.com/.default'To parse the token:
Hope this helps.
If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.