简体   繁体   中英

Authorising access to a Google Sheet using OAuth 2.0

I'm making an Android app that writes/reads values to a Google sheet. The app will be used only by people in our company and there is only one Google sheet that has been already created. I followed this quickstart tutorial. So, after opening the app, OAuth window will be displayed and the user can select his Google account and in this case the user is selecting our organisation's GSuite account. But only the owner (me) of sheet is able to read/write in the app. In the share settings of spreadsheet, the setting is set to Anyone within my organisation can edit. What am I missing here? Why are others in my GSuite organisation unable to access the sheet?

Also, in the Credentials tab in the Google Cloud Console, and in the OAuth consent screen window, there are a lot of settings and I've read something about Scopes (Sensitive) for Google APIs . But my issue here is, the Google sheet ID is already hardcoded in the app and I don't need any user's consent since I'm the owner of the sheet and I'm not accessing the user's spreadsheet and I want to check if the user is my organisation member or not(to prevent misusing the app)

If I understand you can make the Proejct only available internally through the API Console by setting the 'Internal' radio button under the credentials 'Oauth Consent Screen' tab. If you have a requirement to allow external ppl to use the project but wish to limit access to the sheet to internal use only you may need to create a server-side application to in the middle that uses OAuth tokens to access and includes a validation step by checking the user profile email address to ensure it is within your domain before proxying through or performing the sheet actions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM