🐛 Fix userinfo endpoint mismatch oidc
All checks were successful
release-nightly / build-docker (push) Successful in 3m23s
All checks were successful
release-nightly / build-docker (push) Successful in 3m23s
This commit is contained in:
parent
c5126bc4db
commit
997ada9da6
@ -6,6 +6,7 @@ import (
|
|||||||
"code.smartsheep.studio/hydrogen/passport/pkg/services"
|
"code.smartsheep.studio/hydrogen/passport/pkg/services"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -24,7 +25,18 @@ func getPrincipal(c *fiber.Ctx) error {
|
|||||||
return fiber.NewError(fiber.StatusInternalServerError, err.Error())
|
return fiber.NewError(fiber.StatusInternalServerError, err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
return c.JSON(data)
|
var resp fiber.Map
|
||||||
|
raw, _ := jsoniter.Marshal(data)
|
||||||
|
jsoniter.Unmarshal(raw, &resp)
|
||||||
|
|
||||||
|
resp["sub"] = data.ID
|
||||||
|
resp["family_name"] = data.Profile.FirstName
|
||||||
|
resp["given_name"] = data.Profile.LastName
|
||||||
|
resp["name"] = data.Name
|
||||||
|
resp["email"] = data.GetPrimaryEmail().Content
|
||||||
|
resp["preferred_username"] = data.Nick
|
||||||
|
|
||||||
|
return c.JSON(resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
func getEvents(c *fiber.Ctx) error {
|
func getEvents(c *fiber.Ctx) error {
|
||||||
|
Loading…
Reference in New Issue
Block a user