Mark
Mark

Reputation: 23

What OAuth 2.0 Redirect URI do we use for Cordova iOS/Android mobile applications?

We're using Cordova to convert our HTML, JS, and CSS web app to deploy to iOS and Android. We're attempting to implement OAuth 2.0 and OpenID Connect using Azure Active Directory (MSAL.js) into the application. Our redirect URI will not take us back to the mobile app on the device.

The redirect_uri that we're using "msauth.org.businessname.appname://auth" which is created by the Platform configurations for iOS on Microsoft Azure > App Registrations > APP > Authentication: Redirect URLs section (new experience).

We've attempted updating the iOS Custom URL Scheme (https://coderwall.com/p/mtjaeq/ios-custom-url-scheme) to point to "msauth.org.businessname.appname://auth".

RedirectUri = "msauth.org.businessname.appname://auth"

We expect the mobile application to shell out to the browser for the user to enter their credentials and consent. Then the web site will redirect the user to their mobile application.

Upvotes: 2

Views: 2238

Answers (1)

Dan Levy
Dan Levy

Reputation: 4281

Check out this plugin: https://www.npmjs.com/package/cordova-plugin-customurlscheme?activeTab=readme. You add a url scheme when adding the plugin and then you can grab the redirect url (containing the token(s) that you need) using the handleOpenURL() function after the user authenticates. This is all very well documented in the README of the project.

Upvotes: 2

Related Questions