android - Chrome 扩展 : Authenticate with backend without user interaction

标签 android google-chrome google-chrome-extension google-authentication android-authenticator

在我们的 Android 应用程序中,我们能够在没有任何用户交互的情况下获取身份验证 token (目的是了解从我们的应用程序接收到 api 调用,而不是为了获取任何用户信息)

我们使用:

GoogleAuthUtil.getToken(context, anyAccount, "audience:server:client_id:" + MY_CLIENT_ID);

我们如何做一些类似于验证来自 chrome 扩展程序的 api 调用的事情?

更新: 这就是我们如何在 Android 上获得无用户交互的身份验证: http://android-developers.blogspot.co.il/2013/01/verifying-back-end-calls-from-android.html

最佳答案

幸运的是在调用getAuthToken时,你可以传递一个标志 ('interactive': true)('interactive': false)

('interactive': true)

  • If you invoke the API in interactive mode, the user is shown a sign in and/or approval UI when necessary, as shown in the screenshot below:

Image from Google Docs.

('interactive': false)

  • If you invoke the API in silent mode, the API will only return a token if it's possible to produce one without showing any UI. This is useful in cases when an app is doing the flow at app startup, for example, or in general in cases where there is no user gesture involved.

注意

The best practice we suggest is to use silent mode when there is no user gesture involved and use interactive mode if there is a user gesture (for example, the user clicked the Sign In button in your app). Note that we do not enforce any gesture requirement.

关于android - Chrome 扩展 : Authenticate with backend without user interaction,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38421545/

相关文章:

android - 在 Android 上杀死另一个应用程序?

Ubuntu 64 位上 Eclipse 3.5/3.6 中的 Android 插件出现属性问题

linux - 如何使用 jQuery .ajax() 读取目录?

google-chrome - 无法在 chrome 69.0.3497.100 中删除 DOM 断点 "subtree modification"

javascript - 通过 Chrome 扩展将数据发送到 REST

javascript - Chrome 扩展 : Open tab without popup

google-chrome-extension - Chrome 套接字 API 在 Chrome 操作系统(相对于 Ubuntu、Windows)上的行为不同?

javascript - Chrome 设置菜单的扩展权限(chrome ://settings)

java - 适用于各种平台的合适且兼容的数据库

android - 如何在房间dao查询中连接字符串?