Skip to content

Recommended way to use the access token in the client. #40

Answered by Dan6erbond
brahma-dev asked this question in Q&A
Discussion options

You must be logged in to vote

This functionality was addressed in #37. The session is accessible to the user on the client-side. So, you can wrap your own session using the access_token passed by the provider with the profile() callback if you're using the default OAuth2Provider, and then, pass that on to your client-side session with the session() callback.

You may also store refresh tokens in the SKA token as explained in #28 to later rotate access tokens. For that use the profile() callback in your provider and return the tokens along with the profile, and then if necessary refresh the access token using the refresh token in the jwt() callback:

export const appAuth = new SvelteKitAuth({
  providers: [
    new Googl…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@brahma-dev
Comment options

@Dan6erbond
Comment options

Answer selected by Dan6erbond
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