autorest.BearerAuthorization does not have `Token` method
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.
Changing line 47 of auth/autorest.go seems to make it work properly.
tokenProviders = append(tokenProviders, &servicePrincipalTokenWrapper{
tokenType: "Bearer",
tokenValue: authorizer.TokenProvider().OAuthToken(),
})
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 would you like me to open a PR on this?
Hi @ekristen, thanks, a PR would be very much appreciated! 👍
https://github.com/manicminer/hamilton-autorest/pull/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.
could this fix also your issue? https://github.com/manicminer/hamilton-autorest/pull/4