Using Microsoft Graph API with Authorization Code on a GCC-High tenant

itay4 61 Reputation points
2026-11-16T09:16:42.1366667+00:00

Hello,
i am trying to use Authorization code flow and to create the code itself while having a GCC-high tenant, is that even possible? Thanks.

Microsoft Security | Microsoft Graph
0 comments No comments

1 answer

Sort by: Most helpful
  1. AI answer

    2026-11-16T09:17:35.2666667+00:00

    Yes—OAuth 2.0 authorization code flow is supported for Microsoft Graph in GCC High, but the application must be registered in Azure Government and use the GCC High identity and Graph endpoints rather than the commercial-cloud endpoints.

    GCC High configuration

    1. Register the application through the Azure Government portal: https://portal.azure.us.
    2. In the app registration:
      • Add the appropriate platform and redirect URI.
      • Add the required delegated Microsoft Graph permissions.
      • Grant administrator consent when the selected permissions require it.
    3. Use these GCC High endpoints:
      • Microsoft Entra authority: https://login.microsoftonline.us
      • Microsoft Graph root: https://graph.microsoft.us
      • Do not use login.microsoftonline.com or graph.microsoft.com.

    Applications and tokens are isolated by cloud. A token acquired from the global identity service cannot be used against GCC High Microsoft Graph, and the application registration must exist in the corresponding national-cloud environment.^1^

    Request the authorization code

    Direct the user's browser to the GCC High authority, appending this authorization path:

    /{tenant-id}/oauth2/v2.0/authorize
    

    Include these query parameters:

    client_id={application-client-id}
    response_type=code
    redirect_uri={URL-encoded-registered-redirect-URI}
    response_mode=query
    scope=openid offline_access User.Read
    state={random-CSRF-value}
    code_challenge={PKCE-challenge}
    code_challenge_method=S256
    

    Use the actual GCC High tenant ID instead of a commercial tenant or consumer account endpoint. The redirect URI must exactly match one registered for the application. After sign-in and consent, Microsoft Entra redirects the browser to that URI with code and state query parameters.^2^

    The authorization code is therefore not created locally: it is issued after the user completes interactive authentication and consent at the /authorize endpoint.

    For scopes:

    • Short delegated scopes such as User.Read and Mail.Read are valid.
    • A fully qualified GCC High scope uses the https://graph.microsoft.us domain.
    • Request offline_access if the application needs a refresh token.
    • Request only permissions supported by the specific Graph API in GCC High.^3^

    Redeem the code

    Send a form-encoded POST to the same GCC High authority, appending:

    /{tenant-id}/oauth2/v2.0/token
    

    Example request body:

    client_id={application-client-id}
    &grant_type=authorization_code
    &code={authorization-code}
    &redirect_uri={same-redirect-URI}
    &scope=openid offline_access User.Read
    &code_verifier={original-PKCE-verifier}
    

    For a confidential server-side web application, authenticate the application with its configured client credential. Public clients—including SPAs and native applications—must not put a client secret in browser or distributed client code. PKCE is recommended for all application types and required for SPAs.^2^

    Use the resulting access token against GCC High Graph:

    GET /v1.0/me HTTP/1.1
    Host: graph.microsoft.us
    Authorization: Bearer {access-token}
    

    SDK configuration

    If using a Microsoft Graph SDK, configure both sides explicitly:

    • Authentication provider authority: Azure Government / https://login.microsoftonline.us
    • Graph client base URL: https://graph.microsoft.us
    • GCC High scope, where fully qualified: https://graph.microsoft.us/.default

    The SDK defaults to the global Microsoft Graph service unless overridden.^3^

    Graph Explorer is not supported for GCC High, so test through the registered application, an API client, or your own callback handler instead.^1^


    References

    1. Microsoft Graph national cloud deployments
    2. Microsoft identity platform and OAuth 2.0 authorization code flow
    3. Access national cloud deployments with the Microsoft Graph SDKs
    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

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