sirkitree / angular-directive.g-signin

:triangular_ruler: AngularJS Directive for Google Plus Sign-in Button
http://jeradbitner.com/angular-directive.g-signin/
148 stars 84 forks source link

Uncaught TypeError: undefined is not a function #6

Closed apple314159 closed 10 years ago

apple314159 commented 11 years ago

At startup the above message is displayed in the console. It happens in my application as well as the sample in the home page. It seems to work otherwise. Any ideas?

sirkitree commented 11 years ago

I'm not seeing this on the sample page. You're talking about http://jeradbitner.com/angular-directive.g-signin/ correct? What version of Angular are you using?

apple314159 commented 11 years ago

I'm seeing it on the sample page. I'm using Chrome 28.0.1500.71 on Ubuntu. To be clear, this appears on the console during page load; no need to press the button. Pressing the sign in button works fine. I get the same behavior on my web page.

Should also note that the signinCallback function does get called during page load. I don't think that is correct behavior. The authResult parameter contains the following:

client_id "620125449078-4jo21sf1ltlb81o5cbke4sic3ogoo3gm.apps.googleusercontent.com"

cookie_policy "single_host_origin"

error "immediate_failed"

expires_at "1375283515"

expires_in "86400"

g_user_cookie_policy "single_host_origin"

issued_at "1375197115"

response_type "code token id_token gsession"

scope "https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/userinfo.email"

session_state "1ad8641f2838b3fc492da1611976283b65bb176c.t4_l_7rCqzQJ6JL3.903e"

state "" Tried with Firefox 22 and the console shows the object above. Although no error is shown.

sirkitree commented 11 years ago

Sorry man, I'm simply unable to reproduce. I'll leave this open in case anyone else can do so and can find a solution. Thanks for reporting!

doingweb commented 10 years ago

I don't see the TypeError, but I can confirm that the callback gets called during page load. This is expected behavior, though, because the API makes an attempt to log the user in automatically if they have already approved the app. This brief tutorial from Google mentions this in its definition of the immediate_failed error value.

apple314159 commented 10 years ago

I've tried again and I'm no longer able to reproduce the problem.