Help us understand the problem. What is going on with this article?

google api authorizeでの複数スコープ指定+α

More than 5 years have passed since last update.

複数指定は出来るだろうと思っていたが
予想以上に情報が無かったので苦労の末ようやく実現できた。*参考元:本家

まさかSCOPEに指定する区切り文字が「 」(半角スペース)だったとは。。
カンマ、ピリオドとかは試したけど、これは思いつかなかった。

multiauth.js
    var scopesAry = $.map(scopeNames,function(v,idx){
        return "https://www.googleapis.com/auth/" + v;
    });
    var scopes = scopesAry.join(" ");

これでようやく、API使用準備がシンプルに出来るようになった(気がする)

useapi.js
//認証
helper.gapi.functions.authorize(["drive","calendar"]).done(function(res){
    var apis = [
      helper.gapi.functions.loadBy("drive","v2"),
      helper.gapi.functions.loadBy("calendar","v3")
    ];
    //成功後にAPIロード
    $.when.apply(null,apis).then(function(data){
       //使う
    }
anyworks
studying English.
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away