Replies: 1 comment
-
You can store any data in |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm using sveltekit, prisma, the twitch provider and
@twurple/{auth,api}
(to make twitch api calls on behalf of the user).I think a good start would be to stick a twurple
RefreshingAuthProvider
onevent.locals
in myhandle
function, this is an object that can be initialized once and have tokens added to it at runtime.The tokens should probably come from the return value of the twitch provider's
validateCallback
(in fact I've managed to feed this object into twurple with a bit of transformation), but sinceevent.locals
isn't persisted across requests I think I'll need to persist the tokens somewhere after callingvalidateCallback
then inhandle
I can authenticate the twurple client if the persisted token is populated.The part I'm struggling with is where exactly to store the tokens.
From what I understand storing sensitive data on my
AuthUser
is a no-no.Should I put them in a separate prisma model with a relation to the
AuthUser
? or to theAuthSession
? Or maybe theAuthKey
?Beta Was this translation helpful? Give feedback.
All reactions