How to use access token for Microsoft graph API?

Gowri Shankari 0 Reputation points
2023-11-06T12:56:50.97+00:00
Here are the methods I tried using the Microsoft Graph API and their respective outcomes:

Method 1:
- After Single Sign-On (SSO), we obtain an access token.
- This access token is used as a bearer token for Graph API integration.
- Resulted in the following error:
  - URL: https://graph.microsoft.com/v1.0/me/onenote/pages
  - Response:
    - Error Code: 40001
    - Error Message: "The request does not contain a valid authentication token."
  - URL: https://graph.microsoft.com/v1.0/users/gowrishankari97@outlook.com/events
  - Response:
    - Error Code: ErrorAccessDenied
    - Error Message: "Access is denied. Check credentials and try again."

Method 2:
- Obtaining an access token based on the tenant ID and specified parameters.
- Using the obtained access token.
- Resulted in the following errors:
  - URL: https://graph.microsoft.com/v1.0/me/events
    - Response:
      - Error Code: BadRequest
      - Error Message: "/me request is only valid with delegated authentication flow."
  - URL: https://graph.microsoft.com/v1.0/users/gowrishankari97@outlook.com/events
    - Response:
      - Error Code: OrganizationFromTenantGuidNotFound
      - Error Message: "The tenant for tenant guid '{TENANT_ID}' does not exist."

Please let me know the solution for this.
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,448 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
22,400 questions
{count} votes

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.