Find file
Fetching contributors…
Cannot retrieve contributors at this time
99 lines (57 sloc) 3.37 KB

Doximity Mobile Authentication Beta for IOS

The mobile authentication SDK will open a webview, present the user with a Doximity authentication screen, and upon successful login return a token that is valid for your pre-configured app id.


  1. Clone the repo, either as a submodule

    i.e. git submodule add

    or download the zip file.

  2. Drag the DoximityMobileAuthLib folder to your Xcode project file

  3. Under "Build Phases" for your build target, add the "libDoximityMobileAuth.a" under "Link Binary With Libraries"

  4. Under "Build Settings" for your build target, add "$(SRCROOT)/DoximityMobileAuthLib"

Client Code

1. Create the shared instance of DoximityMobileAuth, and set its delegate. Make sure the delegate follows the <DoximityMobileAuthDelegate> protocol

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

        [DoximityMobileAuth shared].delegate = self;

        ... your code ...

     return YES;

2. Configure the library

The IOS library is using the Doximity API documented at which you can read for further detail on the parameters.

The library handles the interception of the redirect URI, and exchanges the returned code for a token from Doximity.

The parameters for "APP_ID", "CLIENT_SECRET", and "URI" will all be provided by Doximity.

As per the documentation,

  • "scope" can be set to "basic" or "colleagues"
  • "state" is a unique string
  • "type" can be either "login" or "verify"
  • [[DoximityMobileAuth shared] configureWithAppId:@"APP_ID" clientSecret:@"CLIENT_SECRET" responseType:@"code" redirectURI:@"URI" scope:@"basic" type:@"login" state:@"ANY"];'

3. Implement the DoximityMobileAuthDelegate protocol

Add the "recievedToken" method to the delegate. A suggested implementation is to dismiss the web view, and create a URL request using the provided token

\#pragma mark DoximityMobileAuthDelegate

- (void) recievedToken:(NSString *)authToken {

        [self.myViewController dismissViewControllerAnimated:YES completion:nil];

    // Example URL request using the token

        NSString *exampleAPIQuery = @"";
        exampleAPIQuery = [exampleAPIQuery stringByAppendingString:authToken];
        NSMutableURLRequest *exampleRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:exampleAPIQuery]];
        [exampleRequest setHTTPMethod:@"GET"];


4. Add code to pop the login view

Using one of the button graphics provided at, open the authentication view by accessing the "loginView" method :

- (IBAction) didTapDoxLogin {

        [self presentViewController:[[DoximityMobileAuth shared] loginView] animated:NO completion:nil];



DoximityMobileAuthLib is licensed under an Apache 2 license. Contributors are required to sign an contributor license agreement. See LICENSE and for more information.