How to obtain Google service account access token javascript

前端 未结 3 1447
北恋
北恋 2020-12-02 19:05

I\'m trying to set up an analytics dashboard of my site for my leadership to view site usage. I don\'t want them to have to have a google account or to add them individual t

3条回答
  •  北海茫月
    2020-12-02 19:36

    You have (below) without single quotes

    gapi.analytics.auth.authorize({
        serverAuth: {
            access_token: token
        }
    });
    

    but for it to work, as per their documentation you need to put single quotes around serverAuth and access_token.

    gapi.analytics.auth.authorize({
        'serverAuth': {
            'access_token': token
        }
    });
    

提交回复
热议问题