简体   繁体   English

Gigya Facebook登录:未调用完成处理程序

[英]Gigya facebook login: completion handler not called

I´m trying to use Gigya-SDK to login in the app via facebook. 我正在尝试使用Gigya-SDK通过Facebook登录该应用程序。 The setup up on Facebook looks good and the native facebbook login without Gigya works fine. 在Facebook上的设置看起来不错,并且没有Gigya的本地facebbook登录效果很好。 But when I call the Gigya method the completion handler after the successful login on the Facebook- Website is never be called. 但是,当我调用Gigya方法时,永远不会调用在Facebook网站成功登录后的完成处理程序。

Here is my very simple code: 这是我非常简单的代码:

 [Gigya showLoginProvidersDialogOver:self providers:providers parameters:nil     
                        completionHandler:^(GSUser *user, NSError *error) {
    if (!error) {
         NSLog(@"works");
    }
    else {
         NSLog(@"Error: %@", error.userInfo);
        // If the login was canceled by the user - do nothing. Otherwise, display an 
           error.
        if (error.code != GSErrorCanceledByUser) {
            NSLog(@"Error: %@", error.userInfo);
            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
                                                            message:@"An error has  
occured. Please try again later"
                                                           delegate:nil
                                                  cancelButtonTitle:@"OK"
                                                  otherButtonTitles:nil];
            [alert show];
        }
    }
}];
  • iOS SDK: 8.1 iOS SDK:8.1
  • Facebbok-SDK: 3.20 Facebbok-SDK:3.20
  • Gigya-SDK : 3.0.6 Gigya-SDK:3.0.6

There are a few thing you will need to check: 您需要检查以下几件事:

  1. Your permissions settings in the Gigya console for the API Key being used. 您在Gigya控制台中使用的API密钥的权限设置。 You need to ensure that you have the "Enable Desktop/Mobile use" permission set as enabled for the API key you are using. 您需要确保已为正在使用的API密钥启用了“启用桌面/移动设备使用”权限设置。

  2. The Facebook Provider configuration settings in the Gigya Console for the API Key being used. Gigya控制台中正在使用的API密钥的Facebook Provider配置设置。 Gigya will select Facebook API v1 by default in the provider configurations; Gigya将默认在提供商配置中选择Facebook API v1; if your Facebook Social Network app is new, then it will be using v2 of the API. 如果您的Facebook社交网络应用程序是新的,则它将使用API​​的v2。 You need to ensure that you have the correct setting selected. 您需要确保选择了正确的设置。

  3. If you are using a CNAME, then you need to ensure that the CNAME The CNAME configuration is set up correctly on the API key, and that your Facebook Developer Console settings are configured to use the CNAME. 如果您使用的是CNAME,则需要确保CNAME在API密钥上正确设置了CNAME配置,并且您的Facebook Developer Console设置已配置为使用CNAME。

If you make any changes, be sure to save the settings before you change screens. 如果进行任何更改,请确保在更改屏幕之前保存设置。

What result do you get with this: 您得到什么结果:

[Gigya loginToProvider:@"facebook"
parameters:nil
completionHandler:^(GSUser *user, NSError *error) {
    if (!error) {
        NSLog(@"works");
    }
    else {
        NSLog(@"error");
    }

}]; }];

After a few attempts I have the solution that has helped me. 经过几次尝试,我得到了对我有帮助的解决方案。

 [Gigya  initWithAPIKey:@"-----------------" APIDomain:@"eu1.gigya.com"];

I had to put the correct APIDomain. 我必须放置正确的APIDomain。 The docs of Gigya refers only to Gigya的文档仅指

[Gigya  initWithAPIKey:@"-----------------"];

which was using US domain by default. 默认情况下使用美国域名。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM