Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure AD Support #112

Closed
anweiss opened this issue Apr 9, 2015 · 3 comments
Closed

Azure AD Support #112

anweiss opened this issue Apr 9, 2015 · 3 comments

Comments

@anweiss
Copy link

anweiss commented Apr 9, 2015

Would like to see Azure Active Directory support officially added. This requires the client_secret and resource parameters. In my testing, adding "https://login.microsoftonline.com/" to the brokenAuthHeaderProviders slice in addition to using resource in place of scope seems to do the trick.

  • Go version: 1.4.2.windows-amd64
@rakyll
Copy link
Contributor

rakyll commented May 11, 2015

We are not willing to implement workarounds for each broken OAuth 2.0 implementation. If this is a blocker for you, please maintain your own of the oauth2 package with the necessary patches.

@bmorton
Copy link

bmorton commented Mar 25, 2017

I found this issue via Google and wanted to note for posterity that this is supported now. To get the resource param on the AuthCodeURL call, you can pass an oauth2.AuthCodeOption to oauth2.AuthCodeURL() as such:

config := &oauth2.Config{
	ClientID:     "my-client-id",
	ClientSecret: "my-client-secret",
	RedirectURL:  "https://localhost",
	Endpoint: oauth2.Endpoint{
		AuthURL:  "https://login.microsoftonline.com/common/oauth2/authorize",
		TokenURL: "https://login.microsoftonline.com/common/oauth2/token",
	},
}
config.AuthCodeURL("state", oauth2.SetAuthURLParam("resource", "https://outlook.office.com"))

You can also set brokenAuthHeaderProviders via oauth2.RegisterBrokenAuthHeaderProvider, but I didn't need to do that for AzureAD on Office 365.

Hope this helps anyone else who finds this issue!

@joaquin386
Copy link

@bmorton can you add a bit more on the code since I did this in python but in Golang i am struggling .... Thx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants