diff options
author | Jaime Martinez <jmartinez@gitlab.com> | 2022-04-08 04:11:53 +0300 |
---|---|---|
committer | Jaime Martinez <jmartinez@gitlab.com> | 2022-04-08 04:12:22 +0300 |
commit | f31927ca19ae769608905cfa4657685758b8d594 (patch) | |
tree | 677473f4f4bd7ebbff44e28adb2c5a25822dd985 /internal | |
parent | 4b70ccd75479dea8cf14a755e3a2ecba7797a449 (diff) |
chore: move check outside of fetching token function
Diffstat (limited to 'internal')
-rw-r--r-- | internal/auth/auth.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/internal/auth/auth.go b/internal/auth/auth.go index 681e3199..05542d21 100644 --- a/internal/auth/auth.go +++ b/internal/auth/auth.go @@ -151,6 +151,11 @@ func (a *Auth) checkAuthenticationResponse(session *hostSession, w http.Response // Fetch access token with authorization code token, err := a.fetchAccessToken(r.Context(), decryptedCode) if err != nil { + if errors.Is(err, context.Canceled) { + httperrors.Serve404(w) + return + } + // Fetching token not OK logRequest(r).WithError(err).WithField( "redirect_uri", redirectURI, @@ -359,10 +364,6 @@ func (a *Auth) fetchAccessToken(ctx context.Context, code string) (tokenResponse // Request token resp, err := a.apiClient.Do(req) if err != nil { - if errors.Is(err, context.Canceled) { - return token, nil - } - return token, err } |