Skip to content

update demo/oauth2-azure.r to oauth2/v2.0 #754

Description

@klin333

In the azure demo, it suggests using a legacy endpoint.

httr/demo/oauth2-azure.r

Lines 18 to 24 in df11e21

# Obtain OAuth2 endpoint settings for azure:
# This uses the "common" endpoint.
# To use a tenant url, create an
# oauth_endpoint(authorize = "https://login.windows.net/<tenant_id>/oauth2/authorize",
# access = "https://login.windows.net/<tenant_id>/oauth2/token")
# with <tenant_id> replaced by your endpoint ID.
azure_endpoint <- oauth_endpoints("azure")

It needs to be updated to the below, as outlined in Microsoft guide https://learn.microsoft.com/en-us/entra/identity-platform/v2-oauth2-auth-code-flow

endpoint <- httr::oauth_endpoint(
  authorize = sprintf("https://login.windows.net/%s/oauth2/v2.0/authorize", tenant_id),  # changed here by adding /v2.0/
  access = sprintf("https://login.windows.net/%s/oauth2/v2.0/token", tenant_id))

In addition httr::oauth_endpoints("azure") gives "https://login.windows.net/common/oauth2/authorize", which is no longer supported since 2018 I believe.

I can confirm this change is required.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions