Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const userPool = new CognitoUserPool(cognitoConfig)
- const authenticationData = {
- Username: this.username,
- Password: this.password
- }
- const authenticationDetails = new AuthenticationDetails(authenticationData)
- const userData = {
- Username: this.username,
- Pool: userPool
- }
- const user = new CognitoUser(userData)
- const self = this
- user.authenticateUser(authenticationDetails, {
- onSuccess: result => {
- const token = result.getAccessToken().getJwtToken()
- console.log('token = ', token)
- self.$store.commit('user/SET_USERNAME', self.username)
- self.$router.push('/dashboard')
- },
- onFailure: err => {
- console.log('err = ', err)
- }
- })
- const userPool = new CognitoUserPool(cognitoConfig)
- const userData = {
- Username: this.user.username,
- Pool: userPool
- }
- console.log('userData = ', userData)
- const user = new CognitoUser(userData)
- user.getUserAttributes((err, result) => {
- if (err) {
- console.log('getUserAttributes err = ', err)
- alert(err.message || JSON.stringify(err))
- return
- }
- for (let i = 0; i < result.length; i++) {
- console.log('attribute ' + result[i].getName() + ' has value ' + result[i].getValue())
- }
- })
Add Comment
Please, Sign In to add comment