Microsoft Azure Stack is an extension of Azure—bringing the agility and innovation of cloud computing to your on-premises environment and enabling the only hybrid cloud which allows you to build and deploy hybrid applications anywhere. We bring together the best of the edge and cloud to deliver Azure services anywhere in your environment.

Integrate Azure AD B2C into an Objective-C iOS application using ROPC

This sample demonstrates how to use Azure AD B2C using a 3rd party library called AppAuth. It has only been tested for compatibility in basic scenarios with Azure AD B2C. Issues and feature requests related to AppAuth should be directed to the library's open-source project.

This sample is a quickstart to help you get started with Azure AD B2C on iOS using a 3rd party library called AppAuth. The focus of this sample is to show you how you can natively build a sign-in experience within your app while using Azure AD B2C. This sample uses an authorization flow called Resource Owner Password Credential (ROPC). Unless an absolute requirement, we do not recommend using this flow. You should use the authorization code flow, which is demonstrated in this sample.

This sample was created by following the README instructions from the iOS AppAuth project on GitHub. For more details on how the sample and the library work, please reference the AppAuth README on GitHub.

To register your app, checkout these steps. Make sure the "Native Client" switch is turned to "Yes". You will need to supply a Redirect URL with a custom scheme in order for your iOS application to capture the callback.

Create a Resource Owner Policy.

Clone the code

Install the libary

Open terminal, and navigate to Examples/Example-iOS_ObjC/folder.

Run the following command to install the AppAuth pod.

pod install

Setting up the iOS App

In Finder, navigate to Examples/Example-iOS_ObjC/ and open Example-iOS_ObjC.xcodeproj. This will open the project in XCode.

Open AppAuthExampleViewController.m, replace the following fields:

kIssuer: Should be https://login.microsoftonline.com/tfp/{Tenant Name}.onmicrosoft.com/{Signup or Signin Policy Name}/v2.0 (This is not necessary for ROPC. This sample allows both experiences in one app)