Server error when trying to login with Facebook federatedSignIn
See original GitHub issueDescription
I had successfully setup Facebook and Google sign in using federatedSignIn method in the Auth module. However, recently the flow breaks returning a server error.
My Config
aws_config: {
Auth: {
identityPoolId: 'ap-southeast-1:my id',
region: 'ap-southeast-1',
userPoolId: 'ap-southeast-my id',
userPoolWebClientId: 'my client id',
mandatorySignIn: false,
},
},
oauth: {
domain: 'my domain.auth.ap-southeast-1.amazoncognito.com',
scope: ['phone', 'email', 'profile', 'openid', 'aws.cognito.signin.user.admin'],
redirectSignIn: 'http://localhost:4200/',
redirectSignOut: 'http://localhost:4200/',
responseType: 'code'
}
Steps to reproduce the behavior:
In my authenticator service (As I am using angular) the method is as follows
loginFacebook() {
Auth.federatedSignIn({customProvider: 'Facebook'}).then(() => {
}).catch(e => {
console.log(e);
});
}
Expected behaviour
The redirect after user authorization should come with access code followed by login success event in the following handler.
Hub.listen('auth', (data) => {
switch (data.payload.event) {
case 'signIn':
console.log('Login success');
Auth.currentAuthenticatedUser().then((u) => {
this.processUser(u);
resolve(true);
}).catch((e) => {
});
break;
case 'signOut':
console.log('Logout success');
this.isLoggedIn = false;
this.user = null;
this.autoLogin = false;
resolve(false);
break;
}
});
Current behaviour
The user gets redirected to
https://www.vinyl.lk/?error_description=Exception%20processing%20authorization%20code&state=GiFNGdcwLTaut52DH6qsZWuSoMaQWPVH&error=server_error#_=_
Apparently, the code is retrieved. However, it is not processed by cognito for some reason. Google login works perfect and Facebook login tend to fail like this. (In rare cases the login happens as expected.)
The network calls relevant to the use case
Versions of SDK used
...
"amazon-cognito-identity-js": "^3.0.12",
"aws-amplify": "^1.1.29-unstable.0",
"aws-sdk": "^2.466.0",
...
Note: I tried with stable version “1.1.29” still not luck (which used to work perfectly on either of version before sometime.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:8
- Comments:14 (1 by maintainers)
Top GitHub Comments
Same issue… tbh, I’m glad it’s not just me! Looking forward to a solution. I suspect it’s a timing issue, when I set a breakpoint in the oauth response handler and pause before continuing then it seems to work more reliably (have not heavily tested this).
I had the same error but it turns out I had tried to map attributes that Google wasn’t returning.
I found this helpful https://stackoverflow.com/a/56979795/10929504