Understanding ArcGIS Client ID

12-21-2016 03:40 PM
Occasional Contributor III

I am trying to understand the ArcGIS Client ID (AppID).  Here is my issue.

I followed the instructions at Applications | ArcGIS for Developers to create and register an app (lets call it App One) and acquire a client id.  Once I have the client id I go into AppStudio and paste the client ID into my app I am creating in AppSudio (lets call it App Two).  

App Two, created in AppStudio, is Survey123 with no modifications (yet).

I do plan on signing in with Portal.

 I am able to cloud make the app successfully using all of the other settings (apple cert, provisioning file, bundle ID and URL Scheme).  

When I cloud make my app, I now have 2 apps in my AppStudio account.  App One and App Two.  App One is registered with my Client ID while App Two is not and I receive an error when I try and register it, (There was an error registering your application).

Furthermore I do not understand why I create a first app for the client ID to use in a seperate app (App Two).  Also, when I side load my app on my iPhone, I receive the error. Invalid client_id error:400 and am unable to log in to my ArcGIS Online Account or any of my portals.

Can someone help me understand and solve this error?


0 Kudos
2 Replies
Esri Esteemed Contributor

Hi Tucker,

In reality, you aren't creating two apps.  You needed to create the first one to test the app before upload, which creates the actual item.  It might be better to start by immediately uploading the application after creation to your account and generate the clientID first thing.  Alternatively, you could simple have 'App1' as a resident testing clientID, reusing the clientID from app to app in development and then updating with the 'App2' clientID for production.  The main benefit of using separate application IDs is better per-app security/sharing and metrics.

Normally invalid client_id occurs because of a mismatch between the Portal/AGO that you registered the app and what you're trying to log into.  If you're creating an application that is going to be used across multiple Portal/AGO environments, you'll need to create an item for the application in each environment and then set them to have identical clientIDs.  It's probably best to create in ArcGIS Online first, then reuse that clientID in Portals - there's a minuscule chance that you might come up with a duplicate clientID and ArcGIS Online has by far the larger population of duplicates to conflict with.  Take a look at the instructions at How To: Add Survey123 for ArcGIS as a registered application to Portal for ArcGIS 10.3.1  and pretend you're app & appID are being used in place of Survey123's.

The other issue that is common to experience in this situation is not have a valid redirect_uri - remember to have that included (like the well-known string urn:ietf:wg:oauth:2.0:oob for native apps)

0 Kudos
Occasional Contributor III

Thanks James, 

Here is my workflow:

Build App in AppStudio.

Upload App to my AGO account.  

Copy Client ID and paste back in my advanced settings in AppStudio.

Build my app using cloud make to get these results:

Once I side load my app to my iphone, I immediately get the invalid ID, without attempting to sign into AGO or my Portal.  I am using 10.4.1 stack with SAML authentication.  

0 Kudos