From 80d4b73ca21ef789df56550cd709c4dbaae526b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Radu=20Lucu=C8=9B?= Date: Wed, 18 Dec 2024 11:16:28 +0200 Subject: [PATCH] fix: OAuth authorize call missing redirect_uri --- globalping/auth.go | 1 + globalping/auth_test.go | 1 + 2 files changed, 2 insertions(+) diff --git a/globalping/auth.go b/globalping/auth.go index b714354..9525537 100644 --- a/globalping/auth.go +++ b/globalping/auth.go @@ -97,6 +97,7 @@ func (c *client) Authorize(callback func(error)) (*AuthorizeResponse, error) { q.Set("code_challenge_method", "S256") q.Set("response_type", "code") q.Set("scope", "measurements") + q.Set("redirect_uri", callbackURL) return &AuthorizeResponse{ AuthorizeURL: c.authURL + "/oauth/authorize?" + q.Encode(), diff --git a/globalping/auth_test.go b/globalping/auth_test.go index 8f0c9f0..05702e5 100644 --- a/globalping/auth_test.go +++ b/globalping/auth_test.go @@ -76,6 +76,7 @@ func Test_Authorize(t *testing.T) { assert.Equal(t, "S256", u.Query().Get("code_challenge_method")) assert.Equal(t, "code", u.Query().Get("response_type")) assert.Equal(t, "measurements", u.Query().Get("scope")) + assert.Equal(t, expectedRedirectURI, u.Query().Get("redirect_uri")) _, err = http.Post(res.CallbackURL+"?code=cod3", "application/x-www-form-urlencoded", nil) if err != nil {