Sunday, June 2, 2024
 Popular · Latest · Hot · Upcoming
116
rated 0 times [  123] [ 7]  / answers: 1 / hits: 17741  / 11 Years ago, sun, october 20, 2013, 12:00:00

I'm trying to retrieve user data from a visitor who has signed in to my site using google + sign in button, but I just end up with the message TypeError: gapi.client is undefined in the javascript console.



Since I could not identify the error I finally copy/pasted the example code from Google, which can be found here: https://developers.google.com/+/web/people/#retrieve_an_authenticated_users_email_address



The only thing I changed was the Client ID (for web applications).



And I STILL get the same error!



Since the example code does not work for me, I'm thinking, maybe my settings in the Google API Console are wrong. I have tried to follow the instructions:




  • Google+ API Service is active

  • Redirect URIs: none

  • JavaScript origins are set to localhost and the actual production
    domain.



Have also tried to upload the example code to the production server, just to see if this was a local environment issue, but I still get the same error.


More From » api

 Answers
13

You must include the script and include the client API in addition to the plusone script:



<script src=https://apis.google.com/js/client:plusone.js type=application/javascript></script>


The demo page was doing it incorrectly, which I've fixed.


[#74859] Friday, October 18, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
leog

Total Points: 225
Total Questions: 113
Total Answers: 118

Location: Oman
Member since Wed, Apr 12, 2023
1 Year ago
;