Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.gitignore
DoxWebViewController.h
DoximityMobileAuth.h
README.md
libDoximityMobileAuth-DEVICE_DEBUG.a
libDoximityMobileAuth-DEVICE_RELEASE.a
libDoximityMobileAuth-SIMULATOR_DEBUG.a
libDoximityMobileAuth-UNIVERSAL_DEBUG.a

README.md

Doximity Mobile Authentication Beta for IOS

Summary
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.

Installation

  1. Clone the repo, either as a submodule

    i.e. git submodule add git@github.com:doximity/DoximityMobileAuthLib.git

    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 http://developer.doximity.com/oauth.html 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 = @"https://www.doximity.com/api/v1/users/current?access_token=";
        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 http://developer.doximity.com/oauth.html, open the authentication view by accessing the "loginView" method :

- (IBAction) didTapDoxLogin {

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

}
Something went wrong with that request. Please try again.