简体   繁体   中英

Using OAuth to retrieve “consumer” email from a linked Google Apps Script within a Google Apps Site

While https://developers.google.com/accounts/docs/OAuth2Login is very descriptive, I cannot seem to wrap my head around how to translate into a Google Apps Script.

The ultimate goal is to have the user click a link, authorize access to their userinfo. I will then use their email address or userId to assign the appropriate spreadsheet to other Google Apps Scripts UIs.

I am certain that some sample code would get me on my way.

Is it even possible?

Can a linked be utilized to make this happen? http://support.google.com/sites/bin/answer.py?hl=en&answer=1224166&topic=1224152&ctx=topic

Check out the OAuth code on the Google Code site . There are some great examples along with the client (and server) code in several different programming languages. Follow along with the samples on how to get the tokens needed.

The trouble is that when you publish your script as a service, it executes under your ID. All the authorization has to be done in the script editor. So, when a third person clicks a button or link or whatever, the script runs under your user ID and all you get back is your own user id.

In short, the answer is no. Sad, but true :(

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