diff --git a/selfservice/strategy/oidc/provider_microsoft.go b/selfservice/strategy/oidc/provider_microsoft.go index 9f8edfc36fc2..57fe21647342 100644 --- a/selfservice/strategy/oidc/provider_microsoft.go +++ b/selfservice/strategy/oidc/provider_microsoft.go @@ -3,6 +3,7 @@ package oidc import ( "context" "encoding/json" + "net/http" "net/url" "strings" @@ -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"` }