Skip to content

Commit

Permalink
microsoft: added DeviceAuthURL to AzureADEndpoint
Browse files Browse the repository at this point in the history
The Microsoft identity platform supports the device authorization grant:

https://learn.microsoft.com/en-us/entra/identity-platform/v2-oauth2-device-code

This PR adds the "https://login.microsoftonline.com/{tenant}/oauth2/v2.0/devicecode" DeviceAuthURL to the AzureADEndpoint.

Fixes #700

Change-Id: I8ca571391e0e0f4d383e3f2f07a66b26edcb4679
GitHub-Last-Rev: 2b953c3
GitHub-Pull-Request: #701
Reviewed-on: https://go-review.googlesource.com/c/oauth2/+/564315
Reviewed-by: Dmitri Shuralyov <[email protected]>
Reviewed-by: Matt Hickford <[email protected]>
Run-TryBot: Matt Hickford <[email protected]>
TryBot-Result: Gopher Robot <[email protected]>
Reviewed-by: Than McIntosh <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
  • Loading branch information
enrichman authored and hickford committed Apr 5, 2024
1 parent d0e617c commit e11eea8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
9 changes: 5 additions & 4 deletions endpoints/endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ var GitLab = oauth2.Endpoint{

// Google is the endpoint for Google.
var Google = oauth2.Endpoint{
AuthURL: "https://accounts.google.com/o/oauth2/auth",
TokenURL: "https://oauth2.googleapis.com/token",
AuthURL: "https://accounts.google.com/o/oauth2/auth",
TokenURL: "https://oauth2.googleapis.com/token",
DeviceAuthURL: "https://oauth2.googleapis.com/device/code",
}

Expand Down Expand Up @@ -227,8 +227,9 @@ func AzureAD(tenant string) oauth2.Endpoint {
tenant = "common"
}
return oauth2.Endpoint{
AuthURL: "https://login.microsoftonline.com/" + tenant + "/oauth2/v2.0/authorize",
TokenURL: "https://login.microsoftonline.com/" + tenant + "/oauth2/v2.0/token",
AuthURL: "https://login.microsoftonline.com/" + tenant + "/oauth2/v2.0/authorize",
TokenURL: "https://login.microsoftonline.com/" + tenant + "/oauth2/v2.0/token",
DeviceAuthURL: "https://login.microsoftonline.com/" + tenant + "/oauth2/v2.0/devicecode",
}
}

Expand Down
5 changes: 3 additions & 2 deletions microsoft/microsoft.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ func AzureADEndpoint(tenant string) oauth2.Endpoint {
tenant = "common"
}
return oauth2.Endpoint{
AuthURL: "https://login.microsoftonline.com/" + tenant + "/oauth2/v2.0/authorize",
TokenURL: "https://login.microsoftonline.com/" + tenant + "/oauth2/v2.0/token",
AuthURL: "https://login.microsoftonline.com/" + tenant + "/oauth2/v2.0/authorize",
TokenURL: "https://login.microsoftonline.com/" + tenant + "/oauth2/v2.0/token",
DeviceAuthURL: "https://login.microsoftonline.com/" + tenant + "/oauth2/v2.0/devicecode",
}
}

0 comments on commit e11eea8

Please sign in to comment.