Skip to content

Commit

Permalink
separate assignment from return
Browse files Browse the repository at this point in the history
  • Loading branch information
chlowell committed Apr 19, 2023
1 parent 62816fd commit 8e66327
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions apps/internal/oauth/oauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ func (t *Client) Credential(ctx context.Context, authParams authority.AuthParams
tr, err := cred.TokenProvider(ctx, params)
if err != nil {
if len(scopes) == 0 {
return accesstokens.TokenResponse{}, fmt.Errorf("token request had an empty authority.AuthParams.Scopes, which may cause the following error: %w", err)
err = fmt.Errorf("token request had an empty authority.AuthParams.Scopes, which may cause the following error: %w", err)
return accesstokens.TokenResponse{}, err
}
return accesstokens.TokenResponse{}, err
}
Expand Down Expand Up @@ -220,7 +221,8 @@ func (t *Client) UsernamePassword(ctx context.Context, authParams authority.Auth
return tr, nil
case authority.Managed:
if len(authParams.Scopes) == 0 {
return accesstokens.TokenResponse{}, fmt.Errorf("token request had an empty authority.AuthParams.Scopes, which may cause the following error: %w", err)
err = fmt.Errorf("token request had an empty authority.AuthParams.Scopes, which may cause the following error: %w", err)
return accesstokens.TokenResponse{}, err
}
return t.AccessTokens.FromUsernamePassword(ctx, authParams)
}
Expand Down

0 comments on commit 8e66327

Please sign in to comment.