AWS奇才,Google+的驗證在AWS Cognito和API網關是未經授權的
我創建了一個POC Web應用程序來測試AWS Cognito
和Federated Identities
一個項目。
我Google+ authentication
延長了POC。當用戶通過Google進行身份驗證時,Google Signin的計數器在聯合身份識別中越來越多,他們顯然正在驗證。
現在我想用一個固定AWS API Gateway
終點,沒有運氣使用的憑據。根據網關,用戶將保持未知狀態。我已經嘗試了API網關授權人配置中的測試功能,如果我使用Cognito用戶CognitoUserSession.idToken
進行測試,則測試返回聲明。
如果我做同樣的試驗與谷歌用戶的idToken
它是未經認證。成功Google簽署相同的AWS Javascript SDK代碼後(作爲Cognito用戶登錄)。憑證用身份標識和會話標記更新,但沒有標識令牌。
正如我在AWS上我可能失去了一些東西,總小白。我應該怎麼做才能獲得有效的idToken?應該以不同的方式完成嗎?
(GoogleLogin是一個陣營成分)
render() {
return (
<GoogleLogin
clientId="44xxx11.apps.googleusercontent.com"
buttonText="Google Login"
onSuccess={this.responseGoogle}
onFailure={this.responseGoogle}
/>
)
}
responseGoogle(response) {
console.log(response.tokenId)
cognitoIdentityCredentials(response.tokenId)
}
cognitoIdentityCredentials(idToken) {
const loginsObj = {
['accounts.google.com']: idToken
}
AWS.config.credentials = new AWS.CognitoIdentityCredentials({
IdentityPoolId: IDENTITY_POOL_ID, // your identity pool id here
Logins: loginsObj
})
AWS.config.credentials.get(function(err) {
if (err) {
console.log(err);
} else {
console.log("---- AWS credentials ----")
console.log(AWS.config.credentials)
// Got credentials, but no valid idToken
}
})
}
代碼似乎確定,但沒有代碼調用LAMBDA ......而這個問題似乎在那裏... – UXDart
我爲什麼要叫LAMBDA在客戶端? – Sven
「現在我試圖使用帶有安全的AWS API網關端點的憑證,但沒有運氣......」 – UXDart