1
0

fix(openid): use the calculated redirect url when authenticating with openid providers

This commit is contained in:
kolaente
2024-01-28 12:41:35 +01:00
parent a20f6ac815
commit ce53663a88
5 changed files with 14 additions and 22 deletions

View File

@ -40,8 +40,9 @@ import (
// Callback contains the callback after an auth request was made and redirected
type Callback struct {
Code string `query:"code" json:"code"`
Scope string `query:"scop" json:"scope"`
Code string `query:"code" json:"code"`
Scope string `query:"scop" json:"scope"`
RedirectUrl string `json:"redirect_url"`
}
// Provider is the structure of an OpenID Connect provider
@ -103,6 +104,8 @@ func HandleCallback(c echo.Context) error {
return c.JSON(http.StatusBadRequest, models.Message{Message: "Provider does not exist"})
}
provider.Oauth2Config.RedirectURL = cb.RedirectUrl
// Parse the access & ID token
oauth2Token, err := provider.Oauth2Config.Exchange(context.Background(), cb.Code)
if err != nil {