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

autorest.BearerAuthorization does not have Token method #150

Open
ekristen opened this issue Feb 11, 2022 · 6 comments
Open

autorest.BearerAuthorization does not have Token method #150

ekristen opened this issue Feb 11, 2022 · 6 comments
Labels
bug Something isn't working package/auth

Comments

@ekristen
Copy link
Contributor

I'm passing an autorest.BearerAuthorization to the wrappedAuth, err := auth.NewAutorestAuthorizerWrapper(authorizer) method call but it returns could not obtain access token from token provider.

It appears it's trying to find .Token method and failing. The autorest.BearerAuthorization provider only has a OAuthToken method.

Is this a bug or am I using it incorrectly?

Thanks.

@ekristen
Copy link
Contributor Author

Changing line 47 of auth/autorest.go seems to make it work properly.

                tokenProviders = append(tokenProviders, &servicePrincipalTokenWrapper{
			tokenType:  "Bearer",
			tokenValue: authorizer.TokenProvider().OAuthToken(),
		})

@manicminer
Copy link
Owner

Hi @ekristen, thanks for reporting this and also your findings! We'll very soon be looking at tidying up the autorest wrapper and will look to incorporate this fix 👍

@manicminer manicminer added bug Something isn't working package/auth labels Feb 17, 2022
@ekristen
Copy link
Contributor Author

@manicminer would you like me to open a PR on this?

@manicminer
Copy link
Owner

Hi @ekristen, thanks, a PR would be very much appreciated! 👍

@ekristen
Copy link
Contributor Author

ekristen commented May 31, 2022

manicminer/hamilton-autorest#3 -- as stated on the PR, this could be wrong. The golang docs for azure sdk and the autorest stuff is not very clear IMO, but this makes this work properly for me with the autorest wrapper.

@mblaschke
Copy link
Contributor

could this fix also your issue?
manicminer/hamilton-autorest#4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working package/auth
Projects
None yet
Development

No branches or pull requests

3 participants