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

Open Beginner friendly
#754 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
65/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
r

Research direction

Start with demo/oauth2-azure.r and inspect the Azure endpoint examples around the referenced lines. Then trace httr::oauth_endpoints("azure") to find where its endpoint values are defined. Done means the demo uses the /oauth2/v2.0/authorize and /oauth2/v2.0/token URLs and the Azure helper no longer returns the legacy endpoints.

Written by the indexing model from the issue text.

Description

In the azure demo, it suggests using a legacy endpoint.
https://github.com/r-lib/httr/blob/df11e216f5e1a30f1bc8df8118e7cd983d9066f9/demo/oauth2-azure.r#L18-L24

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.

Dominant language
R
Stars
981
Forks
2k
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from r-lib/httr

All issues in r-lib/httr

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.