sunfmin / notebook

My Note Book
2 stars 0 forks source link

Google AppScript Enable ScriptApp.getOAuthToken() with more scope when you use those external services in your AppScript #23

Open sunfmin opened 7 years ago

sunfmin commented 7 years ago

For example if I invoke:

Logger.log(Session.getActiveUser().getEmail())

Then ScriptApp.getOAuthToken() Will decode with email, and user_id, verified_email field. Or it will remove those fields and scopes.

{
    "access_type": "offline",
    "audience": "112292435448-99jhi9cctjeo983ki2vdn9kuln59ovgk.apps.googleusercontent.com",
    "email": "felix@theplant.jp",
    "expires_in": 3598,
    "issued_to": "112292435448-99jhi9cctjeo983ki2vdn9kuln59ovgk.apps.googleusercontent.com",
    "scope": "https://www.googleapis.com/auth/documents https://www.googleapis.com/auth/script.external_request https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/spreadsheets https://www.googleapis.com/auth/script.scriptapp https://www.googleapis.com/auth/script.storage https://www.googleapis.com/auth/forms https://www.googleapis.com/auth/script.webapp.deploy https://www.googleapis.com/auth/plus.me",
    "user_id": "117118176587818396116",
    "verified_email": true
}