登录到Chrome应用或扩展程序 [英] Log in to a Chrome app or extension

查看:100
本文介绍了登录到Chrome应用或扩展程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我该如何创建一个需要用户通过我自己的服务登录Chrome应用或扩展程序的身份验证系统?

How would I go about creating an auth system requiring a user to log in to a Chrome app or extension via my own service?

TweetDeck应用程序就是一个很好的例子,用户无需访问外部网站即可完全在该应用程序中登录.

A good example is the TweetDeck app, where the user can log in completely within the app with no need to visit an external website.

推荐答案

使用Chrome Identity API验证用户身份:登录到其Google帐户的用户为getAuthToken,登录到非Google帐户的用户为launchWebAuthFlow.如果您的应用使用自己的服务器对用户进行身份验证,则需要使用后者.

Use the Chrome Identity API to authenticate users: the getAuthToken for users logged into their Google Account and the launchWebAuthFlow for users logged into a non-Google account. If your app uses its own server to authenticate users, you will need to use the latter.

来自 https://developer.chrome.com/apps/app_identity .

以下是实现了Identity API的应用示例: https://github.com/GoogleChrome/chrome-app-samples/blob/master/github-auth/index.js

Here's an example of an app that implements the Identity API: https://github.com/GoogleChrome/chrome-app-samples/blob/master/github-auth/index.js

这篇关于登录到Chrome应用或扩展程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆