Complete a custom passwordless cognito auth flow, and getting tokens in a node app

0

Hey there! I've implement a magic-link auth flow (via this tutorial: https://theburningmonk.com/2023/03/implementing-magic-links-with-amazon-cognito-a-step-by-step-guide/) but I'm having a hard time actually getting the users tokens from the frontend to the backend.

The auth flow is kicked off from a custom CLI I am building. I send a user an email, they click the link in that email to verify their user, and on the front end I sign the user in and send the challenge response

const cognitoUser = await Auth.signIn(email);
const challengeResult = await Auth.sendCustomChallengeAnswer(cognitoUser, token);

This is all successful, but my challenge is I want the tokens (id_token, access_token) to be retrievable from my CLI and then saved to a local auth config file. My CLI is in a listening-for-verification state at this point. A bit stuck on how to proceed here. Any guidance on best practices to achieve this?

No Answers

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