[TIMOB-26731] Trying to implement twitter login in my apps
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | n/a |
| Status | Open |
| Resolution | Unresolved |
| Affected Version/s | Release 7.4.1 |
| Fix Version/s | n/a |
| Components | n/a |
| Labels | android, engSchedule, ios |
| Reporter | NajElie |
| Assignee | Vijay Singh |
| Created | 2019-01-11T12:06:33.000+0000 |
| Updated | 2019-03-26T15:43:27.000+0000 |
Description
Trying to implement twitter login in my apps, I'm using Alloy.builtins.social.
titanium studio SDK 7.4.1GA
var social = require('/alloy/social').create({
consumerSecret : 'XXXXXXXXXXXXXXXXXXXXXXXXXXXX',
consumerKey : 'XXXXXXXXXX'
});
// btn click event
if (!social.isAuthorized()) {
social.authorize();
}
Error parsing a meta element's content: ';' is not a valid key-value pair separator. Please use ',' instead. (8:https://api.twitter.com/oauth/authorize)
any help, thanks in advance.
Attachments
| File | Date | Size |
|---|---|---|
| Screen Shot 2019-01-12 at 11.40.04 PM.png | 2019-01-12T21:40:37.000+0000 | 38955 |
Hello, I can't reproduce the issue on our end with SDK 7.5.0.GA. Tested on iOS 12.1 simulators. I am able to authorize and log in to Twitter. Here is the sample code I used.
Try my code with your key and secret info. Thanks.var social=require('/alloy/social').create({ consumerSecret:'xxxxxxxxx',consumerKey:'xxxxxxxx' }); function doClick(e) { if(!social.isAuthorized()) { social.authorize(); console.info('authorize'); } } $.index.open();Hello sharif, Thanks for your help. Are you able to get the user info after social.authorize(function(e){....}); token, email....?
Hello, Twitter does not allow to get the email address. Can you share the full code that you tried to get the user info? I am trying with
I got an app crash with nothing in the log. Can you share your code? thanks.social.authorize(function(e) { alert(JSON.stringify(e)); });!Screen Shot 2019-01-12 at 11.40.04 PM.png|thumbnail! Twitter allows to get user's email, kindly check the permissions, my target is to add twitter login on my apps. did u implement it or do u have any ready library. my code is : var social=require('/alloy/social').create({ consumerSecret:'xxxxxxxxx', consumerKey:'xxxxxxxx' }); function doClick(e) { if(!social.isAuthorized()) { social.authorize();// have callback as per Appcelerator Document, but it doesn't work for me console.info('authorize'); } } $.index.open(); Thanks in advance
I think the Android part is broken. This part https://github.com/appcelerator/alloy/blob/master/Alloy/builtins/social.js#L391 is failing with a timeout for me. Changing it to
Also note that the response contains \u003C instead of < so the split failed before.function authorizeUICallback(e) { var response = e.source.evalJS('(p = document.getElementById("oauth_pin")) && p.innerHTML;'); e.source.evalJS('document.getElementById("oauth_pin").innerHTML', function(response){ if (response && response !="" && response !="null"){ response = response.replace(/\\u003C/g,'<'); if (response.split("<code>").length > 0){ response ? (pin = response.split("<code>")[1].split("</code>")[0], destroyAuthorizeUI(), receivePinCallback()) : (loadingView && loadingView.hide(), loadingContainer && loadingContainer.hide(), webView && webView.show()), loading = !1, clearInterval(intervalID), estimates[estimateID] = (new Date).getTime() - startTime, Ti.App.Properties.setString("Social-LoadingEstimates", JSON.stringify(estimates)); } } }); }