Closed ejanzzenang closed 4 years ago
I am implementing "amazon-cognito-auth-js" with VueJS using the following component:
<template> <div class="signup"> <button @click="signUpFacebook">Sign in with Facebook</button> </div> </template> <script> import * as AmazonCognitoIdentity from 'amazon-cognito-identity-js'; import {CognitoAuth} from 'amazon-cognito-auth-js'; var cognitoUserPoolId = 'xxxx'; var cognitoUserPoolClientId = 'xxx'; var appclient_id = 'xxxx' export default { name: 'signup', data(){ return { email_address: '', password: '', confirmPw: '', auth: '' } }, methods: { signUpFacebook : function(){ this.auth.getSession(); } }, created() { var authData = { ClientId : appclient_id, // Your client id here AppWebDomain : 'my-sample-app.amazoncognito.com', TokenScopesArray : ['email'], RedirectUriSignIn : 'http://localhost:8080', RedirectUriSignOut : 'http://localhost:8080', IdentityProvider : 'Facebook', // e.g. 'Facebook', UserPoolId : cognitoUserPoolId, // Your user pool id here }; this.auth = new CognitoAuth(authData) console.log(this.auth) this.auth.userhandler = { // * E.g. onSuccess: function(result) { alert("Sign in success"); showSignedIn(result); }, onFailure: function(err) { alert("Error!" + err); } } console.log("authdata set") var redirect_url = window.location.href; this.auth.parseCognitoWebResponse(redirect_url); } } </script>
Although the user is redirected and authenticated, the "onSuccess", "onFailure" callbacks are never called is there something I could be missing?
resolved in this thread: https://stackoverflow.com/questions/57346480/vue-js-onsuccess-and-onfailure-callbacks-not-working
I am implementing "amazon-cognito-auth-js" with VueJS using the following component:
Although the user is redirected and authenticated, the "onSuccess", "onFailure" callbacks are never called is there something I could be missing?