Skip to content
Snippets Groups Projects
Commit 18f5f95b authored by Gabriel Zachmann's avatar Gabriel Zachmann
Browse files

check that we really receive RT

parent 483a7810
No related branches found
No related tags found
No related merge requests found
......@@ -12,8 +12,9 @@ type APIError struct {
// Predefined errors
var (
APIErrorUnknownIssuer = APIError{ErrorInvalidRequest, "The provided issuer is not supported"}
APIErrorStateMismatch = APIError{ErrorInvalidRequest, "State mismatched"}
APIErrorUnknownIssuer = APIError{ErrorInvalidRequest, "The provided issuer is not supported"}
APIErrorStateMismatch = APIError{ErrorInvalidRequest, "State mismatched"}
APIErrorNoRefreshToken = APIError{ErrorOIDC, "Did not receive a refresh token"}
)
// Predefined OAuth2/OIDC errors
......
......@@ -147,7 +147,12 @@ func CodeExchange(state, code string, networkData model.NetworkData) model.Respo
}
return model.ErrorToInternalServerErrorResponse(err)
}
//TODO check if we got a RT
if token.RefreshToken == "" {
return model.Response{
Status: fiber.StatusInternalServerError,
Response: model.APIErrorNoRefreshToken,
}
}
oidcSub, err := getSubjectFromUserinfo(provider.Provider, token)
if err != nil {
return model.ErrorToInternalServerErrorResponse(err)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment