2

I am using a delegated authentication where when an app is launched, it will redirect user to a browser based login screen. Once the user provides credential, if successful, he will be transferred back to native app. How do I transfer session information to native app and also control back to native app?

yogsma
  • 10,142
  • 31
  • 97
  • 154

2 Answers2

3

First thoughts: your browser based login will be submitting to some sort of API? Can you not implement a login form natively and access the same API?

If you have to redirect to a browser based screen you could try to use an embedded UIWebView and use an Objective C to javascript bridge to pass the auth token.

If you have to open Safari, you will have to register a custom URL scheme within your app and generate a link from the login page using Safari... not ideal

davbryn
  • 7,156
  • 2
  • 24
  • 47
  • Authentication is delegated to a third party identity store which I am not in control. So that's why I can implement login form natively. – yogsma Feb 10 '15 at 20:20
  • I am using UIWebView now, but is there any example which can show how to send information back to native app. – yogsma Feb 16 '15 at 20:51
2

Also try to search for the topic here on stackoverflow. There are a lot of good answers which will guide you in the right direction.

How to do authentication in UIWebView properly

How to display the authentication challenge in UIWebView

Referring to your comment that you are using Ping Identity: There are several repos of this company where they show how to integrate their login into an iOS App.

Have a look at this repo: OAuth example There is an example using their OAuth API and also you can find there two word documents describing this in more detail.

Also they have examples for using the UIWebview or the Safari Browser here: Browser Examples

As an addition there are more repos from this company concerning this topic just browse a bit through them.

Community
  • 1
  • 1
dehlen
  • 7,325
  • 4
  • 43
  • 71
  • Thanks...I have looked up those topics before posting here. The issue is not with basic authentication, but when the authentication is delegated to a third party identity provider. How do you handle a scenario when your authentication is delegated and after successful authentication to return back to native app? – yogsma Feb 19 '15 at 14:21
  • Could you give an example of such a "third party identity provider". also does this service maybe provide OAuth or similiar technologies ? If you just want to dismiss the webview after successfully retrieving the credentials you can just dismiss the internal UIWebView. – dehlen Feb 19 '15 at 14:26
  • Ping Federate - They do offer OAuth. – yogsma Feb 19 '15 at 17:16
  • Also even if Ping Federate offers OAuth, we want to support customers who have configured Ping for ADFS or SAML – yogsma Feb 19 '15 at 17:18
  • Thanks, I have awarded you the bounty points, I will look at those examples. – yogsma Feb 19 '15 at 20:53