Description
I am working on an ionic app that uses amplify and cognito to do federated sigin.
sign in code as follows:
doLoginGoogle() {
this.ngZone.run(async () => {
try {
await Auth.federatedSignIn({
customProvider: "google"
});
} catch (error) {
console.log(error);
}
});
}
and then it opens up the broswer and goes back, and then I use deeplinking to open my app again where I do
this.deeplinks
.route({
"/login/": {}
})
.subscribe(
match => {
console.log("match here");
console.log(match.$args);
console.log(match.$link);
console.log(match.$route);
document.location.href =
"http://localhost/login/#" + match.$link.fragment;
},
nomatch => {
console.log("no match here andy", document.URL, nomatch);
}
);
This recreates the request, and I have a hub listening which is
Hub.listen("auth", async data => {
console.log(data);
switch (data.payload.event) {
case "signIn":
console.log("SIGN IN");
// this.state.authState = 'signedIn';
this.state.user = data.payload.data;
console.log(data);
await this.dataSvc.updateUserInfoGoogle(data.payload.data);
this.navCtrl.navigateRoot("/tabs/home");
break;
case "signIn_failure":
// this.state.authState = 'signIn';
this.state.user = null;
this.state.authError = data.payload.data;
break;
case "signOut":
this.state.user = null;
this.state.authError = null;
break;
case "customOAuthState":
this.state.customState = null;
this.state.authError = null;
break;
default:
break;
}
});
However the hub always gets soemthing like this
event type: sigin_failure
data:
TypeError: the given value is not a Promise
at Object.push../node_modules/@aws-sdk/stream-collector-browser/build/index.js.exports.streamCollector (http://localhost/vendor.js:232048:10)
at collectBody (http://localhost/vendor.js:117186:21)
at collectBodyString (http://localhost/vendor.js:117190:12)
at parseBody (http://localhost/vendor.js:117205:12)
at http://localhost/vendor.js:114513:42
at step (http://localhost/polyfills.js:3223:23)
at Object.next (http://localhost/polyfills.js:3204:53)
at http://localhost/polyfills.js:3197:71
at new ZoneAwarePromise (http://localhost/polyfills.js:4261:29)
at __awaiter (http://localhost/polyfills.js:3193:12)
The ionic app works fine in the web browser but fails in android......
not sure what to do here. Can someone please offer some insights on this issue?