In my Vue application, I did
import Amplify, { Auth } from 'aws-amplify'
...
Vue.prototype.$Auth = Auth
in main.js
, and then
const user = await this.$Auth.signIn(this.userInput.email, this.userInput.password)
console.log(user)
in my login component. The console.log prints
Where is the JWT here?
The problem was I hadn't created a new password yet. This is done with a
Auth.completeNewPassword(user, '<new-password>')
where user
is the CognitoUser
object returned from Auth.signIn
.
After this, when doing signIn
again, the signInUserSession
field of the CognitoUser
will contain the access token under user.signInUserSession.accessToken.jwtToken
.