aaronksaunders / test_social

test_social
Other
14 stars 13 forks source link

PIN problem for authorization #13

Open muhammadsabir opened 8 years ago

muhammadsabir commented 8 years ago

When I click authorize after giving my username and password it opens a screen with text, "You've granted access to your_app. Next, return to your_app and enter this PIN to complete the authorisation process. What is it??? please help me... I'm stuck into it... I've posted a question a community... https://community.appcelerator.com/topic/4188/signin-signup-through-twitter-and-google-plus

Thank you... Muhammad Sabir

natefollmer commented 8 years ago

Hi Muhammad,

I have the same issue (Android only, iOS still works as before). This is an issue with Android, not this module. Here is how I go about fixing this on Android.

From this issue: https://github.com/aaronksaunders/test_social/issues/11

"getHtml on the webView is returning null in Android, but again fine in iOS - Just putting this out there in case anybody runs into this error. Doesn't seem to be a fault of this module.

I modified the authorizeUICallback function:

function authorizeUICallback(e) {

     var promptView = Ti.UI.createView({
            width:'30%',
            height:'10%',
            layout: "vertical",
            backgroundColor:'black',
            bottom:"20%"
        }),
        pinField = Ti.UI.createTextField({
            width: Ti.UI.FILL,
            height: Ti.UI.SIZE,
            hintText: 'Enter PIN'
        }),
        pinButton = Ti.UI.createButton({
            width: Ti.UI.SIZE,
            height: Ti.UI.SIZE,
            title: "Authorize"
        });

    promptView.add(pinField);
    promptView.add(pinButton);
    view.add(promptView);

    pinButton.addEventListener('click', function() {
        if (!pinField.value) {
            alert('No PIN found');
        } else {
            pin = pinField.value;
            response = 1;
           response ? ( pin = pinField.value, /*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));
        }
    });
  }