Skip to content

OAuth2 Provider #31

Answered by Dan6erbond
SGarno asked this question in Q&A
Discussion options

You must be logged in to vote

Sorry! That's a bit confusing currently in the demo app I use the profile() callback simply to remap the profile and add the provider information for later use in the jwt() callback. As you can see, I'm able to append as many connections as I want then allowing me to display the connections in the UI:

export const appAuth = new SvelteKitAuth({
  callbacks: {
    jwt(token, profile) {
      if (profile?.provider) {
        const { provider, ...account } = profile; // profile returned by profile() callback
        token = {
          ...token,
          user: {
            ...(token.user ?? {}),
            connections: { ...(token.user?.connections ?? {}), [provider]: account },
          },

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by Dan6erbond
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants