hello.js
hello.js copied to clipboard
Chrome Error
Hi,
I am using HELLOJS with the following configuration:
const GOOGLE_SCOPES = 'https://www.googleapis.com/auth/userinfo.profile, https://www.googleapis.com/auth/userinfo.email'
hello.init({
google: GOOGLE_CLIENT_ID
});
hello(_this.network.google).login({
display: 'popup',
response_type: 'token id_token',
scope: GOOGLE_SCOPES,
force: true // let user choose which account he wants to login with
}).then(function() { .....
The error happens in the login function, where str is parsed into an Object:
// Login
// Using the endpoint
// @param network stringify name to connect to
// @param options object (optional) {display mode, is either none|popup(default)|page, scope: email,birthday,publish, .. }
// @param callback function (optional) fired on signin
login: function() {
.......
// Create a global listener to capture events triggered out of scope
var callbackId = utils.globalEvent(function(str) {
// The responseHandler returns a string, lets save this locally
var obj;
if (str) {
obj = JSON.parse(str);
}
I debugged and found out, that in Chrome str
is already an Object. Because of that, JSON.parse() throws an exception. However in Firefox, str is a String and so no exception!
Also note, that this only happens the first time trying to sign-in after loading the page.
Any ideas why this happens? It has already worked, but somehow doesn't anymore... Could it be related to a failed CORS thing in the popup? (doesn't close after login)
Thank's in advance.
Greetings, Georg Schwarz
Seems to be caused by the same origin as in issue #473
The Portfolium team is running into this as well... We've tested on every major browser, and they all work besides Chrome.
It only happens when you have to enter a new email that your browser doesn't already have a Google account linked up for (using an Incognito window is the easiest way to test).
@MrSwitch any feedback on this one?
@SchwarzGeorg @danielzev I can't reproduce this.
I've updated the Google Login example https://adodson.com/hello.js/demos/google.html can you recreate it on that page?
Also can you include this object which should be a string. Please obfusicate any tokens. Thanks
Somehow not reproducable any more, also in my own application. Maybe a Chrome Update fixed that!
yeaaaaaaa!!!!! thanks for letting us know @SchwarzGeorg Looks good on Portfolium.com too