Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which is the right method to handle oauth2.0 done in server using Ionic framework?

I am creating an Ionic app which has multiple 3rd party integration. I already have a java server which does the oauth2 authentication for the 3rd parties and redirect to the callback url in the server itself.

Now my task is to open back the app page after the server callback url is done.

I have tried the following method: monitoring the url changes in app using ionic and redirect after the successful callback.

Which is the best way to handle this sitn.

Thanks.

like image 572
hybrid Avatar asked Oct 26 '15 10:10

hybrid


2 Answers

Frankly, I haven't done anything like this. But to my mind, you can check ngcordova oauth implementation for ideas.

   var browserRef = window.open(your_url);

   browserRef.addEventListener("loadstart", function(event) {
       //your code
   });
   browserRef.addEventListener('exit', function(event) {
       deferred.reject("The sign in flow was canceled");
   });

Check oauth.js source for more details.

Moreover, you can find the sample of using this implementation on this page.

like image 137
RredCat Avatar answered Oct 03 '22 05:10

RredCat


http://mcgivery.com/using-custom-url-schemes-ionic-framework-app/

Above link may help you. If I am thinking correctly what you want?

like image 41
Rahul Avatar answered Oct 03 '22 05:10

Rahul