How to get access token of Graph explorer using java?

Suraj Dengale 45 Reputation points
2024-03-04T12:02:24.4966667+00:00

I have created one enterprise application that has all the required delegated permissions***(please check the attached screenshot below image)*** but still with these permissions I am not able to read one one-on-one chat message of the signed-in user***(please check the attached screenshot for the error)*** but I can send the message to any chat member using same bearer token.

I checked the Graph Explorer API and with the Graph Explorer bearer token I am able to read those chats.

Can someone please suggest a way to read those chats with my current bearer token if it's possible, if not can you please suggest how I can get graph explorer bearer token using Java.User's image

User's image

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,774 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,630 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. CarlZhao-MSFT 41,126 Reputation points
    2024-03-05T08:36:06.01+00:00

    Hi @Suraj Dengale

    This is an obvious error, as your error message indicates that your token is missing one of the Chat.Read or Chat.ReadWrite permissions. The Chat.Read and Chat.ReadWrite permissions you assigned to your app in the portal have not yet been granted user or admin consent, so they are not synced to the token.

    Before starting, please try clicking the "Grant admin consent for xxxxxx" button in the portal or grant dynamic consent for the above permissions when the user is logged in.

    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.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.