AWS Amplify Gen 2 - How to get refresh token?

0

Is there a way to get user refresh token for Cognito using AWS Amplify Gen 2?

`import { Amplify } from "aws-amplify" import { signIn, signOut, getCurrentUser, fetchAuthSession } from "aws-amplify/auth"

const session: AuthSession = await fetchAuthSession(); ` 'session.tokens' contains the only accessToken and idToken. I'd like to store refresh token in backend for future needs.

Thank you.

1 Answer
4

You may force a session refresh by using the fetchAuthSession method with the forceRefresh flag:

import { fetchAuthSession } from "aws-amplify/auth";
const session = await fetchAuthSession({ forceRefresh: true });
EXPERT
answered a month ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions