Open
Description
error: get-token: authentication error: authcode-browser error: authentication error: authorization code flow error: oauth2 error: could not exchange the code and token: oauth2: "invalid_request" "AADSTS900144: The request body must contain the following parameter: 'client_id'. Trace ID: ... Correlation ID: ...Timestamp: 2024-08-02 12:27:19Z" "https://login.windows.net/error?code=900144"
It seems that Azure does need some parameters, which others don't ... with this two lines patched, this issue would be solved.
diff --git a/oauth2.go b/oauth2.go
index 09f6a49..591a4d9 100644
--- a/oauth2.go
+++ b/oauth2.go
@@ -224,6 +224,7 @@ func (c *Config) Exchange(ctx context.Context, code string, opts ...AuthCodeOpti
v := url.Values{
"grant_type": {"authorization_code"},
"code": {code},
+ "client_id": {c.ClientID},
}
if c.RedirectURL != "" {
v.Set("redirect_uri", c.RedirectURL)
@@ -280,6 +281,7 @@ func (tf *tokenRefresher) Token() (*Token, error) {
tk, err := retrieveToken(tf.ctx, tf.conf, url.Values{
"grant_type": {"refresh_token"},
"refresh_token": {tf.refreshToken},
+ "client_id": {tf.conf.ClientID},
})
if err != nil {
Metadata
Assignees
Labels
No labels
Activity