2
我正在嘗試爲我的Android應用創建一個Google Cloud Endpoints後端,該後端使用用戶的Google帳戶進行身份驗證。我發現Java API包含OAuth範圍的註釋,但python文檔僅對此做出單一引用。如何將Google帳戶身份驗證添加到Python中的Google Cloud Endpoints
這裏是我使用的端點上的註釋:
@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'])
但是生成的代碼沒有任何範圍:
/**
* Available OAuth 2.0 scopes for use with the .
*
* @since 1.4
*/
public class NotesScopes {
private NotesScopes() {
}
}
甚至生成的服務類似乎缺少件:
/**
* 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/";
我假設我缺少一些註釋或配置選項。有誰知道它可能是什麼?
RE:「即使生成的服務類似乎缺少了部分:」,請參閱文檔https://developers.google.com/appengine/docs/python/endpoints/gen_clients,「無」顯示在「 DEFAULT_ROOT_URL',因爲在運行'endpointscfg.py'之前沒有指定'hostname'。 – bossylobster 2013-03-01 02:40:35
這裏缺少的東西,我認爲在文檔中還不太清楚,是您必須爲受衆使用Web客戶端,而不是Android客戶端。這似乎特別反直覺,但一些更清晰的文檔將有所幫助。在網絡上也有許多其他問題,需要花費數週的時間才能將解決方案拼湊在一起。 也許在文檔中添加一段文字,說明您必須在apis控制檯中執行哪些操作,而不僅僅是針對android的東西,但最初的部分會有所幫助。 – rharter 2013-03-11 22:21:36