最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to obtain access_token for google analytics? - Stack Overflow

programmeradmin1浏览0评论

I am using Google Analytic Embed API. I want auto authorization so that user don't need to enter credential. But I am not getting how to obtain access_token.

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

I am using Google Analytic Embed API. I want auto authorization so that user don't need to enter credential. But I am not getting how to obtain access_token.

gapi.analytics.auth.authorize({    
  serverAuth: {       
    access_token: 'Server side generated token'      
  }  
});
Share Improve this question edited May 11, 2015 at 10:58 mana 6,5476 gold badges52 silver badges71 bronze badges asked May 11, 2015 at 10:45 JenJen 3981 gold badge4 silver badges15 bronze badges 2
  • You cant auto authorize with JavaScript, the user must authenticate themselves. – Linda Lawton - DaImTo Commented May 11, 2015 at 11:04
  • @DaImTo authorizing via JavaScript is perfectly fine, as long as you've obtained an access token in a secure way yourself. – Philip Walton Commented May 11, 2015 at 22:24
Add a ment  | 

1 Answer 1

Reset to default 0

To get an access token you're going to have to go through the OAuth 2.0 authorization flow. You can find more details about how OAuth 2.0 works and the steps required here:
https://developers.google./identity/protocols/OAuth2

发布评论

评论列表(0)

  1. 暂无评论