Skip to content

Commit

Permalink
handler/oauth2: grant scopes before the access token is generated (#177)
Browse files Browse the repository at this point in the history
Signed-off-by: Nikita Vorobey <nikita@vorobey.by>
  • Loading branch information
nikita-v authored and arekkas committed Jun 8, 2017
1 parent 82944aa commit 3497260
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions handler/oauth2/flow_authorize_code_token.go
Expand Up @@ -81,15 +81,15 @@ func (c *AuthorizeExplicitGrantHandler) PopulateTokenEndpointResponse(ctx contex
return errors.Wrap(fosite.ErrInvalidRequest, err.Error())
}

for _, scope := range authorizeRequest.GetGrantedScopes() {
requester.GrantScope(scope)
}

access, accessSignature, err := c.AccessTokenStrategy.GenerateAccessToken(ctx, requester)
if err != nil {
return errors.Wrap(fosite.ErrServerError, err.Error())
}

for _, scope := range authorizeRequest.GetGrantedScopes() {
requester.GrantScope(scope)
}

var refresh, refreshSignature string
if authorizeRequest.GetGrantedScopes().Has("offline") {
refresh, refreshSignature, err = c.RefreshTokenStrategy.GenerateRefreshToken(ctx, requester)
Expand Down

0 comments on commit 3497260

Please sign in to comment.