Reputation: 243
I would like interegrate google identity toolkit inside an angular app but after flow is not and calls to google api by the google identity kit widget is returning errors. This is the route after redirecting and it's an empty page http://localhost:8000/?mode=select/#/GoogleIdentity
POST /verifyAssertion
{
"error": {
"errors": [
{
"domain": "global",
"reason": "invalid",
"message": "INVALID_RESPONSE"
}
],
code": 400,
"message": "INVALID_RESPONSE"
}
}
Here is my code:
.controller('GoogleIdentityCtrl', ['$scope', '$rootScope', function ($scope, $rootScope, localStorageService) {
var config = {
apiKey: 'dkfjdslfjeoi-not-real-api-key',
signInSuccessUrl: '/',
idps: ['google'],
oobActionUrl: 'http://localhost:8000/#/GoogleIdentity',
siteName: 'this site',
};
window.google.identitytoolkit.start('#gitkitWidgetDiv', config, 'JAVASCRIPT_ESCAPED_POST_BODY');
}]);
window.google.identitytoolkit.signInButton('#navbar', { widgetUrl: 'http://localhost:8000/#/GoogleIdentity', signOutUrl: '/'' });
Upvotes: 2
Views: 607
Reputation: 9821
The page with the widget URL needs to have ?mode=select
on the end of it, without this you get the INVALID_RESPONSE error.
The flow I think the tutorial gives is you have one page with the sign in button on it, this then redirects to the page with the widget template in it (let's call it callback.html). callback.html needs to be the widget url in the developer console and you'll need to make callback.html an allowed referral URL.
Upvotes: 1