Shareed2k / goth_fiber

Package goth_fiber provides a simple, clean, and idiomatic way to write authentication packages for fiber framework applications.
MIT License
88 stars 14 forks source link

Setting expired cookies. #45

Open ksXV opened 1 year ago

ksXV commented 1 year ago

I haven't modified goth_fiber.SessionStore yet when I hit the callback the cookie that gets sent from the server is already expired. I tried setting the session like this https://github.com/markbates/goth#security-notes but still to no result. Does anybody have a clue why is this happening ?

AlyxPractice commented 1 year ago

Same here, the cookie expires instantly.

AlyxPractice commented 1 year ago

Fixed by passing the option gf.CompleteUserAuthOptions{ShouldLogout: false}:

app.Get("/auth/:provider/callback", func(ctx *fiber.Ctx) error {
user, err := gf.CompleteUserAuth(ctx, gf.CompleteUserAuthOptions{ShouldLogout: false})
if err != nil {
    return err
}
ctx.JSON(user)

return nil
})