Skip to content

Commit

Permalink
fix: add error handling after token parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
lfleischmann committed Apr 9, 2024
1 parent 3b6507f commit 049a4c0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions backend/thirdparty/provider_microsoft.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ func (p microsoftProvider) GetUserData(token *oauth2.Token) (*UserData, error) {
jwt.WithValidator(p.issuerValidator()),
)

if err != nil {
return nil, fmt.Errorf("could not parse id token: %w", err)
}

if parsedIDToken == nil {
return nil, errors.New("could not parse id token")
}

idTokenClaims, err := p.getIdTokenClaims(parsedIDToken.PrivateClaims())
if err != nil {
return nil, fmt.Errorf("could not extract claims from id token: %w", err)
Expand Down

0 comments on commit 049a4c0

Please sign in to comment.