No Twitter User data mapped

Hi. When I sign in a Twitter user no user data is stored on the user, and the email stored in the db is just a random number. Here is my code that runs without error. Version 3.0.3 of the SDK.

Map<String, String> twitterFieldsMappings = new HashMap<String, String>();
//twitter field first, my db field second
twitterFieldsMappings.put(“screen_name”, “name”);
twitterFieldsMappings.put(“profile_image_url”, “imageUrl”);

Backendless.UserService.loginWithTwitter(this, twitterFieldsMappings, new AsyncCallback<BackendlessUser>() {
@Override
public void handleResponse(BackendlessUser backendlessUser) {
startActivity(new Intent(getBaseContext(), SplashActivity.class));
finish();
}

@Override
public void handleFault(BackendlessFault fault) {
    showInfoDialog(getResources().getString(R.string.everbook_request_error), fault.getMessage());
}

});

I have same problem in iOS SDK. Can’t give name, avatar, etc. Version SDK 3.0.6

Hi all.
We are working on this issue.

Regards,
Kate.

Any updates?

Or maybe you can help me give screen_name and user_profile_url manually after login to Twitter?

Thank you

Hi Sergey,

I checked the internal system and the ticket appears as “Closed”, which means it has been fixed and will be available in the next update of the production environment (scheduled for next week).

Regards,
Mark

Hello Mark,

I see that you have new version. I use version 3.0.8 for iOS. I updated yesterday. But I try use fieldMapping and nothing. Don’t work. My fields is empty. I have to get name of user and user_profile. Can you help me or fix this feature?

My code:

NSDictionary *fieldsMapping = @{
                                    @"name": @"name",
                                    @"profile_image_url": @"avatar"
                                    };
[[[Backendless sharedInstance] userService] easyLoginWithTwitterFieldsMapping:fieldsMapping];

Can you check it?

Hello, Sergey.

The fix for this issue will be released this week. We’ll let you know about it.
Thanks for checking out on this.

The fix for this issue is already released. Please let us know if you encounter any difficulties with it.

Hello,
Is the problem fixed for ios. I tried using field mapping to get twitter screen_name but name is still null.
Code :

 
 
 
 
 
 
 
 
 func easyTwitterLogin() { 
 
 
 
 backendless.userService.easyLoginWithTwitterFieldsMapping(["email" : "email"]) 
 
 backendless.userService.easyLoginWithTwitterFieldsMapping(["name" : "screen_name"], response: { (result: NSNumber!) in 
 
 print ("Result: \(result)") 
 
 }) { (fault: Fault!) in 
 
 print("Server reported an error: \(fault)") 
 
 } 
 
 }


Regards,

I have the same problem on android. Always get null on mappings

I think twitter’s handle is “twitter_name” and not “screen_name”. Could you try that?

Hi, Quatja!
Can you show the code you use?

I have tried ( twitter_name , twitterName , name, screen_name & screenName ) but neither of them work.

In the fieldsMapping map the Key is the name of the Twitter API field and Value is the name you want to save it in Backendless.
Try ([“screen_name” : “TheNameYouWantItToBeSavedInBackendless”])
You can contact https://dev.twitter.com/overview/api/users for information about other fields.
As you can notice, there’s not field as “email” in Twitter API, so fieldsMapping will not help to get it.

Does the login with Twitter works for the iOS version? For me, it doesn’t redirect back into the app nor the fields mapping are saved for the user.

Yes, login with Twitter should work for the iOS version. Make sure to use the latest libs available in the github repo:

https://github.com/Backendless/ios-SDK/tree/master/SDK/lib/CommLibiOS

Hi Mark, I’ve updated the libraries. Now the user method “setProperties” is not available anymore. Why don’t you keep the compatibility between updates?

My problem is that when the app tries to redirect, first it says that “Safari cannot open the page because the address is invalid” and if I refresh the page, it opens a page saying “Could not approve social account”. What am I missing here?

Hi Cristian,

We indeed changed the names of two methods of BackendlessUser class to avoid a conflict with setter/getter names:

Regards,
Slava

Thanks Vyacheslav. Do you have any idea why I end up like that when I try to login with Twitter?