我們正在嘗試爲Glass用戶提供請求從時間線卡發送給他們的電子郵件的功能。在通知回調Servlet中,我們嘗試以下檢索用戶的電子郵件地址:檢索登錄的Google Glass用戶的電子郵件地址?
String userId = notification.getUserToken();
Credential credential = AuthUtil.getCredential(userId);
Mirror mirrorClient = MirrorClient.getMirror(credential);
Contact contact = MirrorClient.getContact(credential, userId);
檢索掀起了認證的用戶的用戶信息對象的電子郵件時,我們沒有得到一個結果返回。我們的應用程序都有可用的應用程序服務器的以下範圍:
"https://www.googleapis.com/auth/glass.timeline "
"https://www.googleapis.com/auth/glass.location "
"https://www.googleapis.com/auth/userinfo.profile "
"https://www.googleapis.com/auth/userinfo.email "
"https://www.googleapis.com/auth/contacts"
我們現在可以檢索驗證用戶的電子郵件地址,在那裏我缺少一個許可或者是有其他的手段來要求的數據?
你能澄清你使用的是什麼語言,到底哪個庫您正在使用? – Prisoner
您還可以確認您從哪裏獲取Credential對象,並且這是經過身份驗證的用戶的憑證對象? – Prisoner
我們使用了利用google-api-services-mirror Maven依賴項的Java starter項目。我們正在使用來自其OAuth2客戶端Java庫的Google Credential。到目前爲止,我們還沒有任何身份驗證問題,並且能夠創建完整的時間表並獲取用戶位置。 –