클라이언트에서 Facebook 로그인 및 AWS Cognito를 사용하여 인증 절차를 설정했습니다. dynambodb 테이블에 facebook id가있는 사용자의 참조가 필요하며 API 호출에 유효한 facebook id (이 Facebook ID가 AWS Cognito ID와 일치 함)가 있는지 확인하십시오. 이 답변에 대한 해결책을 찾았습니다 : AWS Cognito, Lambda, User credentials in DynamoDBAWS의 ID IDCognito 변경
그러나 동일한 장치에서 여러 번 Cognito로 로그인하면 콘솔에 몇 가지 다른 ID가 있음을 발견했습니다. 이와 같이 : screen shot
신원 ID는 특정 기기 ID가 특정 기기 ID 인 경우 고유하다고 생각했습니다. 실수를 하나합니까? ID가 변경되면 어떻게 페이스 북 사용자의 데이터를 DynamoDB에 저장할 수 있습니까? InitCognito() 메소드가 실행되면, 내가 (한 번 나는 같은 장치, 무단 식별 번호 변경에 대한이 응용 프로그램을 다시 설치)를 무단 식별 ID를 가져
void Start()
{
InitCognito();
}
public void InitCognito()
{
UnityInitializer.AttachToGameObject (this.gameObject);
credentials = new CognitoAWSCredentials (
identity_pool_id, // Identity Pool ID
region // Region
);
Debug.Log ("identity_pool_id = " + identity_pool_id + " region = " + region);
credentials.GetIdentityIdAsync(delegate(AmazonCognitoIdentityResult<string>
result) {
if (result.Exception != null) {
Debug.LogError(result.Exception.ToString());
}
string identityId = result.Response;
Debug.Log("identityId = "+identityId);
FBInit();
});
}
public void FBInit()
{
FB.Init(this.OnInitComplete, this.OnHideUnity);
Debug.Log("FB.Init() called with " + FB.AppId);
}
public void FBLogin()
{
FB.LogInWithReadPermissions(new List<string>() { "public_profile", "email", "user_friends" }, this.HandleResult);
}
private void OnInitComplete()
{
Debug.Log("Success - Check log for details");
Debug.Log("Success Response: OnInitComplete Called\n");
Debug.Log(string.Format(
"OnInitCompleteCalled IsLoggedIn='{0}' IsInitialized='{1}'",
FB.IsLoggedIn,
FB.IsInitialized));
if (AccessToken.CurrentAccessToken != null)
{
Debug.Log("Access token = "+AccessToken.CurrentAccessToken.ToString());
}
FBLogin();
}
private void OnHideUnity(bool isGameShown)
{
Debug.Log("Success - Check log for details");
Debug.Log(string.Format("Success Response: OnHideUnity Called {0}\n", isGameShown));
Debug.Log("Is game shown: " + isGameShown);
}
protected void HandleResult(IResult result)
{
if (result == null)
{
Debug.Log("Null Response\n");
return;
}
// Some platforms return the empty string instead of null.
if (!string.IsNullOrEmpty(result.Error))
{
Debug.Log("Error - Check log for details");
Debug.Log("Error Response:\n" + result.Error);
}
else if (result.Cancelled)
{
Debug.Log ("Cancelled - Check log for details");
Debug.Log("Cancelled Response:\n" + result.RawResult);
}
else if (!string.IsNullOrEmpty(result.RawResult))
{
Debug.Log ("Success - Check log for details");
Debug.Log ("Success Response:\n" + result.RawResult);
Debug.Log ("Access Token = "+AccessToken.CurrentAccessToken);
Debug.Log ("Access Token = "+AccessToken.CurrentAccessToken.TokenString);
Debug.Log ("Access User Id =" + AccessToken.CurrentAccessToken.UserId);
credentials.AddLogin ("graph.facebook.com", AccessToken.CurrentAccessToken.TokenString);
if (credentials.CurrentLoginProviders.Length > 0) {
Debug.Log (credentials.CurrentLoginProviders[0]);
}
Debug.Log (credentials.GetCachedIdentityId());
}
else
{
Debug.Log ("Empty Response\n");
}
}
:
이 내 코드입니다. Facebook 사용자 ID와 토큰을 성공적으로 가져올 수 있습니다. credentials.AddLogin() 메소드가 실행 된 후, Debug.Log (credentials.GetCachedIdentityId())는 Identity Id가 Facebook ID로 참조 된 특정 ID가 아닌 unauthorized Identity Id와 동일 함을 보여줍니다. credentials.AddLogin()을 잘못된 방법으로 사용합니까?
감사합니다.
이러한 ID를 클릭하십시오. 그들에게 로그인이 연결되어 있습니까? –
두 명이 로그인을 연결했습니다. "링크 된 로그인"필드는 첫 번째 필드에 "graph.facebook.com"을 표시하고 두 번째 필드에는 "DISABLED us-east-1"을 표시합니다. – DogJunior