You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a placeholder for issues related to Esri OAuth with Ionic 2+ and the ArcGIS API for JavaScript 3.x and 4.x.
Issue: You cannot use IdentityManager with the latest versions of Ionic (3.5) and Chrome (Android 7.1.2). This issue hasn't been testing or verified on iOS. Note, don't be fooled that the functionality works with ionic serve because it won't work on Android WebView or InAppBrowser.
Build a custom Cordova plugin that uses Chrome Intents.
Code Snippets:
Use a well knownredirect_uri that can be used for programmatic extraction: let location = "https://www.arcgis.com/sharing/rest/oauth2/authorize?&client_id=" + _APP_ID + "&response_type=code" + "&redirect_uri=urn:ietf:wg:oauth:2.0:oob";
Or, use an Android Intent redirect_uri along with the partial example below: let location = "https://www.arcgis.com/sharing/rest/oauth2/authorize?&client_id=" + _APP_ID + "&response_type=code" + "&redirect_uri=my-ags-app://auth";
Partial example for an Intent-based approach using TypeScript.
Install the InAppBrowser:
cordova plugin add cordova-plugin-inappbrowser
Import the InAppBrowser into the TypeScript page where you are initiating the login process:
import { InAppBrowser } from '@ionic-native/in-app-browser';
Initiate the login and return a code. You'll need the code to get a valid token for making OAuth requests. See the ArcGIS article below that is included in the references for additional details:
And, in MainActivity.java if you go with the Intent-based approach:
protected void onNewIntent(Intent i) {
super.onNewIntent(i);
// Check that the received intent starts with redirect URI
if (i.getData() != null && i.getData().toString().startsWith("my-ags-app://auth")) {
Log.d("CordovaActivity", "CODE= " + i.getData().toString());
}
}
And, in AndroidManifest.xml add the following in the main <activity> section:
This is a placeholder for issues related to Esri OAuth with Ionic 2+ and the ArcGIS API for JavaScript 3.x and 4.x.
Issue: You cannot use
IdentityManager
with the latest versions of Ionic (3.5) and Chrome (Android 7.1.2). This issue hasn't been testing or verified on iOS. Note, don't be fooled that the functionality works withionic serve
because it won't work on Android WebView or InAppBrowser.Known Workarounds:
Code Snippets:
Use a well known
redirect_uri
that can be used forprogrammatic extraction
:let location = "https://www.arcgis.com/sharing/rest/oauth2/authorize?&client_id=" + _APP_ID + "&response_type=code" + "&redirect_uri=urn:ietf:wg:oauth:2.0:oob";
Or, use an Android Intent
redirect_uri
along with the partial example below:let location = "https://www.arcgis.com/sharing/rest/oauth2/authorize?&client_id=" + _APP_ID + "&response_type=code" + "&redirect_uri=my-ags-app://auth";
Partial example for an Intent-based approach using TypeScript.
Install the InAppBrowser:
Import the InAppBrowser into the TypeScript page where you are initiating the login process:
Then add it to your array of
providers
:Then add it to the app's
constructor
:Initiate the login and return a
code
. You'll need thecode
to get a valid token for making OAuth requests. See the ArcGIS article below that is included in the references for additional details:And, in
MainActivity.java
if you go with the Intent-based approach:And, in
AndroidManifest.xml
add the following in the main<activity>
section:References:
Google: Modernizing OAuth Interactions in Native Apps
Esri ArcGIS: Security and Authentication using Mobile and Native User Logins
The text was updated successfully, but these errors were encountered: