Single Sign on saml 2.0 for ionic mobile apps

I did SSO using https://github.com/onelogin/java-saml 

It was working good for my website. But the question was how can I integrate it with my mobile app.

then I found a ionic plugin that best suited for my requirements.

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

How I used this plugin:

There are two files in my web project index.jsp and consume.jsp.

1. SSO starts from index.jsp (This is the start point of my web app).
 2. Then redirects to organization page which according to saml 2.0 configuration which I am not mentioning here right now.
3. User fills the credentials and hit the submit button.
4. Response come back to consume.jsp.
5. In consume.jsp I have checked login is successful or not.
6. If login is successful then I redirect to home.jsp otherwise error message.

This was right in the case of web app. But the question was how can I achieve this is mobile app.

Answer is here:

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

Install this plugin in your ionic app as instructions give in this link.

Write somewhere in body tag of consume.jsp:

<a href="ionicapp://" id="myLink">Open my app</a>

and between the code of successful login write:

<script type="text/javascript">
      document.getElementById('myLink').click();
</script>

This is a trick. What this code will do is: It will open your mobile app on successful login :).

Ask questions in comments if any problem you face.

3 comments:

  1. Nice trick! I love Ionic. What do you think about React Native?

    ReplyDelete
    Replies
    1. Hey, Yoy can try below link:

      http://stackoverflow.com/questions/10237031/how-to-open-a-native-ios-app-from-a-web-app

      Delete
    2. Hi Can you kindly specify how did you get the token to pass to the IDP

      Delete