Is storing an AWS Cognito user from a user signing in and checking that in a middleware a secure way to authenticate and guard routes and data? I've seen a bunch of ways of using Auth0 and Nuxt's 'auth' module but I do not understand if those are necessary when I am already using AWS' Cognito to handle authentication.
I can get the Amplify Authenticator to successfully allow them to sign in and store the returned user and info to the Vuex store (store.state.auth.user).
If I just use a middleware to globally guard routes like:
export default function({store, redirect}){
if(!store.state.auth.user){
return redirect('/login')
}
}
and then use that same 'store.state.auth.user' value in store to look up and retrieve their files is that 1. Secure 2. Following best practices?