Search code examples
google-sheetsgoogle-sheets-apigoogle-oauth

Unable to authorize to Google Sheets v4 API from web app using javascript


I am able to read and write data to a google sheet when running the web application on my localhost:8080 using the quickstart for v4 API.

When I deploy the app on external tomcat server, the authorization does not seem to happen at load

<script src="https://apis.google.com/js/client.js?onload=checkAuth">

I'm running the application at http://10.200.99.110:8080/MyApp. In the API manager credentials I have type 'Web Application' and Javascript origin uris' as

http://localhost:8080    
http://10.200.99.110:8080

I am a beginner to OAuth and would appreciate any help in getting it to work.


Solution

  • Apparently there was some problem in tomcat, I did a reload from the tomcat manager after deploying a new war file and it worked.

    Also, I noticed that modifying javascript origin uris in Google API Credentials manager takes couple of minutes to reflect in the application.