当前位置: 动力学知识库 > 问答 > 编程问答 >

Is it possible to determine user profile using Chrome Extension API?

问题描述:

Is it possible to determine which user profile is logged in Chrome from my custom extension using Chrome API?

Thanks!

网友答案:

There is no Chrome-API for that, the best (any only) way is to use oAuth:
https://developers.google.com/accounts/docs/OAuth2

UPDATE:

Yesterday Google has published news about the Identity API at the Chromium blog.
The Identity API may only work with packaged Apps!

Identity API

The Identity API allows packaged apps to authenticate users securely using OAuth 2.0 without the user having to provide a username and password directly to the app. The Identity API supports authentication using Google Accounts as well as third party providers such as GitHub and Foursquare.

The Identity API also gives packaged apps secure access to Google APIs such as Google+, Calendar and Drive. As an example, Google Keep uses the Identity API to authenticate users as well as to call the Google Drive API to save notes to Drive. The Identity API uses a webview based UI to show the OAuth consent dialog and when the Google+ API scope is used, it allows users to control who can see their activity on the app.

Source: http://blog.chromium.org/2013/07/richer-access-to-google-services-and.html
Documentation at developer.chrome.com: https://developer.chrome.com/trunk/apps/app_identity.html

网友答案:

If it's possible to do so, consider writing a Chrome packaged app instead. The Identity API will give you the information you need.

分享给朋友:
您可能感兴趣的文章:
随机阅读: