I'm trying to make a Google Cloud Endpoints backend for my Android app that uses a user's Google Account for authentication. I've found that the Java API contains annotations for OAuth scopes, but the python documentation only makes a single reference to that.

我正在尝试为使用用户的Google帐户进行身份验证的Android应用制作Google Cloud Endpoints后端。我发现Java API包含OAuth作用域的注释,但是python文档只对它有一个引用。

Here is the annotation I'm using on the endpoint:

这是我在端点上使用的注释:

@endpoints.api(name='notes', version='v1',
           description='Notes API',
           allowed_client_ids=[CLIENT_ID, endpoints.API_EXPLORER_CLIENT_ID],
           audiences=[AUDIENCE],
           scopes=['https://www.googleapis.com/auth/userinfo.email'])

But the generated code doesn't have any scopes:

但生成的代码没有任何范围:

/**
 * Available OAuth 2.0 scopes for use with the .
 *
 * @since 1.4
 */
public class NotesScopes {

  private NotesScopes() {
  }
}

Even the generated service class seems to be missing pieces:

即使生成的服务类似乎缺少部分:

/**
 * The default encoded root URL of the service. This is determined when the library is generated
 * and normally should not be changed.
 *
 * @since 1.7
 */
public static final String DEFAULT_ROOT_URL = "https://None/_ah/api/";

/**
 * The default encoded service path of the service. This is determined when the library is
 * generated and normally should not be changed.
 *
 * @since 1.7
 */
public static final String DEFAULT_SERVICE_PATH = "notes/v1/";

I'm assuming that I'm missing some annotation or config option. Does anyone know what it might be?

我假设我缺少一些注释或配置选项。有谁知道它可能是什么?

1 个解决方案

#1


0

The scopes attribute in the annotation isn't used in the Android auth flow, which is one of the reasons it's not included in the generated Java code. Instead, Android uses an ID token, which contains sufficient information to represent your user/application to the backend, without requesting a scope.

注释中的scopes属性未在Android身份验证流中使用,这是其未包含在生成的Java代码中的原因之一。相反,Android使用ID令牌,其中包含足够的信息来向后端表示您的用户/应用程序,而无需请求范围。

更多相关文章

  1. Java已经启动,但是返回的退出代码=13 eclipse [duplicate]
  2. MD5加密,java工具类 String 转变成MD5 String 详细代码,工具类And
  3. Android有用的代码片段
  4. Robotium用例通过代码自动解锁屏幕
  5. Android代码性能优化技巧
  6. Android公钥私钥及代码详细解读
  7. android OSChina 客户端源代码剖析
  8. android代码混淆 GSON完满解决
  9. Android开源代码解读の地图照片应用Panoramio的实现详解(六)

随机推荐

  1. 关于转换
  2. 这可能是你见过的最全的网络爬虫干货总结
  3. 学习C的第三天-操作符
  4. 学习C的第三天-数组
  5. S1到S9,545名职业选手,有多少人折戟全球总
  6. React Router v4教程:为你的 React 应用创
  7. 带你一步步设置layui的tree树结构点击高
  8. 一文详细揭秘 Redis 持久化,了解一下?
  9. 学习C的第三天-要记住的ASCII码值
  10. JavaScript 程序员可以从C ++中学到什么[