oauth 2.0 webview ios sdk


I am building an ios SDK and implementing the oauth flow.

Basically I need to do the following:

<ul><li>User clicks on a button.</li> <li>Sees a webview popup.</li> <li>They sign/sign up in the webview, giving permission to access account.</li> <li>The webview redirects them back to a url with a code in the url.</li> <li>I need to somehow use that code to make an api call to get their access token.</li> </ul>

How can I do the above in objective-c? Meaning how can I show them a webview with my site signup/sign flow, and get access to the access token using the code in the redirected url?

I know how to do the webview, but I am not sure how to get the code to use to make an api call.


Take a look at <a href="https://github.com/auth0/Auth0.iOS" rel="nofollow">this example here</a>. It is configured to use <a href="http://developers.auth0.com" rel="nofollow">our service</a> (which implements OAuth 2), but it is open source, so you can modify it to point to whatever OAuth server you are planning to connect to.

The key is the method shouldStartLoadWithRequest (see <a href="https://github.com/auth0/Auth0.iOS/blob/master/Auth0Client/Auth0WebViewController.m#L99" rel="nofollow">here</a>) that will notify you every time a URL is going to be loaded. If the URL is the final redirect to the callback address (with the token in it ), then you parse it from the request and extract the <strong>access_token</strong> (or better yet the <strong>JWT</strong>).


  • Working example of paypal Website Payments Pro Hosted Solution Iframe?
  • How to run requests.get asynchronously in Python 3 using asyncio?
  • System call time out?
  • Generating anchors with PyYAML.dump()?
  • Angular page doesn't refresh after data is added or removed
  • R sqldf renaming a field in a select statement
  • EntLib Way to Bind “Null” Value to Parameter
  • Available space left on drive - WinAPI - Windows CE
  • is there a way to update filter with async data
  • Configure Spring's MappingJacksonHttpMessageConverter
  • Retrieve IP address of device
  • How to autopopulate a field in SugarCRM form
  • During installation of Django, why do I keep getting ImportError: No module named django?
  • pillow imaging ImportError
  • SAXReader not re-ecape characters
  • cygwin cannot exec 'git-add--interactive' permission denied
  • How to assign byte[] as a pointer in C#
  • How can I set a binding to a Combox in a UserControl?
  • How to set ini file attributes during an Inno install
  • All Classes Conforming to Protocol Inherit Default Implementation
  • Java Scanner input dilemma. Automatically inputs without allowing user to type
  • Sails.js/waterline: Executing waterline queries in toJSON function of a model?
  • javascript inside java/jsp code
  • Sending data from AppleScript to FileMaker records
  • Weird JavaScript statement, what does it mean?
  • Websockets service method fails during R startup
  • Apache 2.4 - remove | delete | uninstall
  • Circular dependency while pushing http interceptor
  • Windows forms listbox.selecteditem displaying “System.Data.DataRowView” instead of actual value
  • Unit Testing MVC Web Application in Visual Studio and Problem with QTAgent
  • KeystoneJS: Relationships in Admin UI not updating
  • AngularJs get employee from factory
  • Benchmarking RAM performance - UWP and C#
  • Load html files in TinyMce
  • Acquiring multiple attributes from .xml file in c#
  • How to set the response of a form post action to a iframe source?
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • Change div Background jquery
  • How can I remove ASP.NET Designer.cs files?
  • java string with new operator and a literal