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

int128 / kubelogin - AADSTS900144: The request body must contain the following parameter: 'client_id' #734

Open
markush81 opened this issue Aug 2, 2024 · 0 comments

Comments

@markush81
Copy link

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.

int128/kubelogin#536

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 {
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

1 participant