nuxt-community / auth-module

Zero-boilerplate authentication support for Nuxt 2
https://auth.nuxtjs.org
MIT License
1.91k stars 927 forks source link

Questions about cognito authentication with nuxt2 + nuxt-auth + aws-amplify #1848

Open youngseo-im opened 1 year ago

youngseo-im commented 1 year ago

I'm using cognito and nuxt-auth in a nuxt2 project

I want to apply a custom UI instead of the login UI provided by AWS, so I implemented login using aws-apmlify package, but the token is not renewed, how should I configure nuxt.config.js?

I didn't configure amplify with the CLI because it only requires authentication during the aws-amplify service.

// current nuxt.config.js 스크린샷 2023-05-16 18 49 51

// current Login Page 스크린샷 2023-05-16 18 51 05

// Request URL and error message 스크린샷 2023-05-16 18 56 07 스크린샷 2023-05-16 18 55 09 스크린샷 2023-05-16 19 00 40

youngseo-im commented 1 year ago

Sorry, I'll edit the question.

After modifying the settings in nuxt.config.js like this, I don't get the error I posted above. Instead, it doesn't renew the token when it expires, what should I do?

스크린샷 2023-05-17 10 34 10

tumenor commented 1 year ago

Hi!

Take a look at this scheme https://auth.nuxtjs.org/schemes/refresh I believe it's because the local scheme does not implement a refresh logic. Also by looking at endpoints, it does not have a configuration for the refresh endpoint.

However looking at the endpoints, it seems like oauth2 which would be https://auth.nuxtjs.org/schemes/oauth2

If you have to implement your own strategy there is documentation for this as well https://auth.nuxtjs.org/guide/scheme#creating-your-own-scheme