DISQUS-API-Recipes icon indicating copy to clipboard operation
DISQUS-API-Recipes copied to clipboard

Integrating disqus in a mobile app

Open yiannistri opened this issue 8 years ago • 46 comments

Hi,

I'm following your guide to display disqus comments on my Android app. It works fine for the most part as comments are being displayed nicely. However, I can't get the login flow to work whether it's via email or through any of the social media. The result is that my users can see the comments but cannot login or add any new comments.Anyone following this guide can easily reproduce this behaviour. I'm suspecting that the popup window that you now display on clicking Login doesn't play well with embedded webview. Any suggestions on how to solve this?

yiannistri avatar Jun 09 '16 12:06 yiannistri

Same issue here... Any feedback please?

jasonatt avatar Aug 21 '16 15:08 jasonatt

Hi @yiannistri and @jasonatt. Thank you for reporting this issues. There is indeed a problem with the login flow, which we became aware of recently. We have a fix that we're working on addressing in that documentation soon, likely this week. Apologies for the outdated documentation.

dmatt avatar Aug 21 '16 15:08 dmatt

Hi, that was fast :)

Will you notify us via this thread or shall I subscribe somewhere?

Cheers

jasonatt avatar Aug 21 '16 15:08 jasonatt

Yes :). I'll be sure to mark this issue as closed once we fix the documentation. Subscribing to this issue should be good. On Sun, Aug 21, 2016 at 8:48 AM Jason Attard [email protected] wrote:

Hi, that was fast :)

Will you notify us via this thread or shall I subscribe somewhere?

Cheers

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/disqus/DISQUS-API-Recipes/issues/22#issuecomment-241265037, or mute the thread https://github.com/notifications/unsubscribe-auth/AC0YKYjuyOSAFPIM7GPzc-m0s6dJfagQks5qiHM1gaJpZM4Ix7ml .

dmatt avatar Aug 21 '16 15:08 dmatt

Cool Thanks

jasonatt avatar Aug 21 '16 15:08 jasonatt

Hello @dmatt! I've to get Disqus integrated in my android application and for that I'm waiting for the new documentation. Any updates?

RamizSami avatar Aug 24 '16 06:08 RamizSami

We'll have some updated instructions for android very soon (most likely this week), sorry for the wait. I'll be sure to update this Issue once we have more to share. On Tue, Aug 23, 2016 at 11:21 PM RamizSami [email protected] wrote:

Hello @dmatt https://github.com/dmatt! I've to get Disqus integrated in my android application and for that I'm waiting for the new documentation. Any updates?

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/disqus/DISQUS-API-Recipes/issues/22#issuecomment-241968586, or mute the thread https://github.com/notifications/unsubscribe-auth/AC0YKR-mhQtqQpj3Nkqs4rxMOvLw5qsDks5qi-L7gaJpZM4Ix7ml .

dmatt avatar Aug 25 '16 01:08 dmatt

Having the same issue, not able to comment after navigating back to the comment thread url when a successful login is detected.

therealmax avatar Aug 26 '16 15:08 therealmax

@dmatt any updates?

RamizSami avatar Aug 29 '16 06:08 RamizSami

Yes, the mobile instructions are still a work in progress. Our developers have an updated Windows UWP example here https://github.com/ryanvalentin/disqus-install-examples/tree/master/windows-uwp. We will be adding iOS and android soon but no ETA yet. On Sun, Aug 28, 2016 at 11:23 PM RamizSami [email protected] wrote:

@dmatt https://github.com/dmatt any updates?

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/disqus/DISQUS-API-Recipes/issues/22#issuecomment-243041493, or mute the thread https://github.com/notifications/unsubscribe-auth/AC0YKbplxM9r3KW-Yf_twm3KvvTV04AJks5qknrmgaJpZM4Ix7ml .

dmatt avatar Aug 29 '16 17:08 dmatt

I found that the issue doesn't exist in android 4.4.2, but android 5 and above still have the issue.

therealmax avatar Aug 29 '16 21:08 therealmax

@dmatt Hello, Is there going to be Javascript documentation for this? I've had a look through the windows documentation and each time I'm trying to sign in I'm not seeing any of these url endings "#!auth%3Acancel", "#!auth%3Asuccess", #!auth%3Afail" to be able to redirect anywhere, it's just sticking on the auth start one, but if I restart the app I will be signed in. I'd love to get this working asap as I've spent a good few days on it now.

taml avatar Aug 31 '16 11:08 taml

Hi, I can confirm taml issue. I have a cordova build of the app and on ios I can see the ending urls and all work fine but on android does not detect them so cannot redirect.

jasonatt avatar Sep 01 '16 22:09 jasonatt

Hey @jasonatt have you managed to get the redirects working on iOS? I'm building a Ionic / Cordova App too! It would be good to compare code to see how you've implemented Disqus as I'm getting Disqus to show the right comments for the right posts 98% of the time ( for some reason it's not bringing the right ones in on two posts) but haven't managed to get anywhere at all with the redirects!

taml avatar Sep 03 '16 10:09 taml

Hi @taml,

I am using the in app browser and listen to when the page finishes loading to detect the url and redirect based on that. Perhaps @dmatt can assist as I think the paths are different on android...

 $scope.disqusUrl = "Your Url of the starting page"

$scope.disqusUrlCall = function(url) {
 var ref = cordova.InAppBrowser.open(encodeURI($scope.disqusPushUrl), '_blank', 'location=no', clearsessioncache="yes", clearcache="yes");
 ref.addEventListener('loadstop', checkUrl);
};

function checkUrl(params) {
 //console.log(params.url);
 if (params.url.indexOf("disqus.com/next/login-success") > -1 || params.url.indexOf("disqus.com/_ax/facebook/complete") > -1 || params.url.indexOf("disqus.com/_ax/google/complete") > -1 || params.url.indexOf("disqus.com/_ax/twitter/complete") > -1) {
 //alert("Redirect from Disqus");
 cordova.InAppBrowser.open(encodeURI($scope.disqusUrl), '_blank', 'location=no');
} 
}

jasonatt avatar Sep 03 '16 10:09 jasonatt

Hi @jasonatt Thanks for sharing your code. Where are you putting that code? At the moment I have this in my controllers.js file `$scope.showComments = function (postid, posttitle, posturl) {

var disqus_identifier = postid;
var disqus_title = posttitle;
var disqus_url = posturl;
var url = "views/app/disqus.html?";
$scope.disqusurl = url + "shortname=mysiteshortname&url=" + encodeURIComponent(disqus_url) +
"&title=" + encodeURIComponent(disqus_title) + "&identifier=" + encodeURIComponent(disqus_identifier);
$scope.disqusurl = $sce.trustAsResourceUrl($scope.disqusurl);

}; ` I'm also using a directive linked to the Cordova in app browser so I can target a specific link to open in the in app browser by calling it in a

taml avatar Sep 06 '16 12:09 taml

Hi,

Its in a controller. I have a button for the user to open the in app browser with disqus by calling the disqusUrlCall function.

However my url is located from the server as I have the disqus script running from there so I basically send the parameters to the server and show the comments page via inapp browser. its the only way i found to work properly.

jasonatt avatar Sep 11 '16 09:09 jasonatt

@dmatt any updates?

Thanks

jasonatt avatar Oct 04 '16 08:10 jasonatt

So it sounds like we would also need instructions on how to put Disqus on a Ionic/Cordova app as well. I can look into that, but I'm not exactly sure what the pitfalls are off the top of my head.

ryanvalentin avatar Oct 04 '16 17:10 ryanvalentin

The main issue I found it that after the user logs in I cannot redirect them on Android. It works on ios however.

jasonatt avatar Oct 04 '16 19:10 jasonatt

@ryanvalentin Instructions for Ionic / Cordova would be so helpful!

taml avatar Oct 04 '16 20:10 taml

Hey @ryanvalentin , any news on how to add disqus on a Cordova app?

Are there any plans for this? I 'd like to know cause we can wait and release our app with the disqus commenting system, only if it's in your immediate plans...

Thanks!

georgekosmidis avatar Oct 19 '16 12:10 georgekosmidis

@taml @georgekosmidis I have disqus working (login/out/comment) with a purely javascript implementation on android. What problems are you all having, I might be able to help out.

MaxTimothy avatar Oct 31 '16 18:10 MaxTimothy

For those on iOS that found this broken, the key url to watch out for is "https://disqus.com/next/login/?forum=myforumname#!auth%3Astart" If you were reloading the comments after login success and waiting for "https://disqus.com/next/login/?forum=myforumname" That won't work anymore. I had to specifically make sure the auth%3Astart one went through without reloading the comments again for it to work.

jrossfeld avatar Nov 18 '16 01:11 jrossfeld

Has anyone tried to implement this to ionic 2 / angular 2?

brtka avatar Nov 30 '16 15:11 brtka

@Brle88 http://stackoverflow.com/questions/36102556/is-this-the-right-way-to-embed-disqus-in-angular2-component maybe this can help you

pablogonzales avatar Dec 09 '16 11:12 pablogonzales

@MaxTimothy can you help me with an example(repo or code) , how you are handling the login with disqus in a hybrid app

correasebastian avatar Jan 26 '17 21:01 correasebastian

@dmatt any updates?

Thanks

correasebastian avatar Feb 02 '17 14:02 correasebastian

@correasebastian Show me some code so I can see what you've tried/doing and I'll see if I can help, but with out it I have no way of knowing what's going on in your program.

MaxTimothy avatar Feb 02 '17 15:02 MaxTimothy

@MaxTimothy thanks for you answer,

Im using Cordova CLI: 6.4.0 Gulp version: CLI version 3.9.1 OS: Mac OS X El Capitan Node Version: v6.7.0

testing on android 5.1.0 this is my code

var disqusUrl = 'https://kyky.localtunnel.me/?shortname=ufwtest&url=https://ufw-app-staging.herokuapp.com/&title=third';
var inAppCall;

function disqusUrlCall() {
  var options = "location=yes,clearsessioncache=yes,clearcache=yes"
  inAppCall = cordova.InAppBrowser.open(encodeURI(disqusUrl), '_blank', options);
  inAppCall.addEventListener('loadstop', checkUrl);
};

function checkUrl(params) {
  //console.log(params.url);
  if (params.url.indexOf("disqus.com/next/login-success") > -1 || params.url.indexOf("disqus.com/_ax/facebook/complete") > -1 || params.url.indexOf("disqus.com/_ax/google/complete") > -1 || params.url.indexOf("disqus.com/_ax/twitter/complete") > -1) {


    // inAppCall.removeEventListener('loadstop', checkUrl);
    /*
    // first attemp: this does not work, after openning  ask for login  again
     cordova.InAppBrowser.open(encodeURI(disqusUrl), '_blank', 'location=no');
    */


    /*
    // second  attemp: this does not work, after redirecting  ask for login  again
      var script = 'window.location="' + disqusUrl + '"';
      debugger;
      inAppCall.executeScript({
        code: script
      }, function(params) {
        console.log('script execute successfully', params)
      })
    */

  }
}

disqusUrlCall()

this is the path:

  1. Open inappbrowser and load the disqus embed

  2. i click login, and succesfully logged in

  3. redirect to the disqus forum ( but is not logged in)

any help will be appreciate

correasebastian avatar Feb 02 '17 22:02 correasebastian