Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-26731] Trying to implement twitter login in my apps

GitHub Issuen/a
TypeBug
Priorityn/a
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 7.4.1
Fix Version/sn/a
Componentsn/a
Labelsandroid, engSchedule, ios
ReporterNajElie
AssigneeVijay Singh
Created2019-01-11T12:06:33.000+0000
Updated2019-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

FileDateSize
Screen Shot 2019-01-12 at 11.40.04 PM.png2019-01-12T21:40:37.000+000038955

Comments

  1. Sharif AbuDarda 2019-01-11

    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.
       var social=require('/alloy/social').create({
       consumerSecret:'xxxxxxxxx',consumerKey:'xxxxxxxx'
       });
       function doClick(e) {
       if(!social.isAuthorized()) {
       social.authorize();
       console.info('authorize');
       }
       }
       $.index.open();
       
    Try my code with your key and secret info. Thanks.
  2. NajElie 2019-01-12

    Hello sharif, Thanks for your help. Are you able to get the user info after social.authorize(function(e){....}); token, email....?
  3. Sharif AbuDarda 2019-01-12

    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
       social.authorize(function(e) {
       			alert(JSON.stringify(e));
       		});
       
    I got an app crash with nothing in the log. Can you share your code? thanks.
  4. NajElie 2019-01-12

    !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
  5. Michael Gangolf 2019-01-13

    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
       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));
       				}
       			}
       		});
           }
       
    Also note that the response contains \u003C instead of < so the split failed before.

JSON Source