Skip to content

Commit

Permalink
fix: check return code of ms graphapi /me request. (#2647)
Browse files Browse the repository at this point in the history
Co-authored-by: Jonas Hungershausen <jonas.hungershausen@ory.sh>
  • Loading branch information
floriankramer and jonas-jonas committed Sep 12, 2022
1 parent d7ce190 commit 3f490a3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions selfservice/strategy/oidc/provider_microsoft.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package oidc
import (
"context"
"encoding/json"
"net/http"
"net/url"
"strings"

Expand Down Expand Up @@ -99,6 +100,10 @@ func (m *ProviderMicrosoft) updateSubject(ctx context.Context, claims *Claims, e
}
defer resp.Body.Close()

if resp.StatusCode != http.StatusOK {
return nil, errors.WithStack(herodot.ErrInternalServerError.WithReasonf("Unable to fetch from `https://graph.microsoft.com/v1.0/me: Got Status %s", resp.Status))
}

var user struct {
ID string `json:"id"`
}
Expand Down

0 comments on commit 3f490a3

Please sign in to comment.