Dan6erbond / sk-auth

Authentication library for use with SvelteKit featuring built-in OAuth providers and zero restriction customization!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Enhancement] Post Token Callback

ByronCobb opened this issue · comments

commented

I've come across a scenario in which I would like to add additional information to the created token. I see there is a jwt callback, but I don't want to re-implement the cookie logic. It would be great if there was a callback that could manipulate the token just before it is saved to the cookie.

Something like this
image

Thoughts?

Hmm. If I'm understanding what you want correctly, the JWT callback is the one you want. It's called JWT, but really what you're being given is the data in the JWT (see ./src/auth.ts) which you can change as you wish. It's a plain old JavaScript object that you can also modify the types of if you need to.