mirror of
https://github.com/golang/oauth2.git
synced 2025-07-21 00:00:09 +08:00
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 golang/oauth2#700 Change-Id: I8ca571391e0e0f4d383e3f2f07a66b26edcb4679 GitHub-Last-Rev: 2b953c3d57c3a03b68e1c118c7663d84c8f71116 GitHub-Pull-Request: golang/oauth2#701 Reviewed-on: https://go-review.googlesource.com/c/oauth2/+/564315 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Matt Hickford <matt.hickford@gmail.com> Run-TryBot: Matt Hickford <matt.hickford@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
33 lines
1.2 KiB
Go
33 lines
1.2 KiB
Go
// Copyright 2016 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
// Package microsoft provides constants for using OAuth2 to access Windows Live ID.
|
|
package microsoft // import "golang.org/x/oauth2/microsoft"
|
|
|
|
import (
|
|
"golang.org/x/oauth2"
|
|
)
|
|
|
|
// LiveConnectEndpoint is Windows's Live ID OAuth 2.0 endpoint.
|
|
var LiveConnectEndpoint = oauth2.Endpoint{
|
|
AuthURL: "https://login.live.com/oauth20_authorize.srf",
|
|
TokenURL: "https://login.live.com/oauth20_token.srf",
|
|
}
|
|
|
|
// AzureADEndpoint returns a new oauth2.Endpoint for the given tenant at Azure Active Directory.
|
|
// If tenant is empty, it uses the tenant called `common`.
|
|
//
|
|
// For more information see:
|
|
// https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-v2-protocols#endpoints
|
|
func AzureADEndpoint(tenant string) oauth2.Endpoint {
|
|
if tenant == "" {
|
|
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",
|
|
DeviceAuthURL: "https://login.microsoftonline.com/" + tenant + "/oauth2/v2.0/devicecode",
|
|
}
|
|
}
|