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
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令牌,其中包含足够的信息来向后端表示您的用户/应用程序,而无需请求范围。