UIWebView not detecting redirection

I am creating a Login API using OAuth2 Workflow. The server supports OAuth2 authorization. I open an OAuth2 authorization url in a webview that looks likehttps://subdomain.domain.com/oauth2/authorize?client_id=ios-app&redirect_uri=<redirect-uri>&response_type=code

When the login is successfully completed on the server, it opens a page whose url is similar to https://subdomain.domain.com/oauth2/authorize?state=&code=<authorization-code>

To login, I need to extract this authorization code from the url and make an OAuth token request using that code as a parameter.

I am trying to intercept a webView:shouldStartLoadWithRequest:navigationType:

webview using the UIWebView delegate method . But this delegate method doesn't fire when a redirect occurs. I have set the webview delegate toself

How do I detect this redirect so that I can intercept it and extract the code from the URL?

+3


source to share





All Articles