arcgis.gis login failure

3901
5
Jump to solution
02-25-2021 01:41 PM
Tim_Callahan
New Contributor II

I'm a beginner learning GIS, coding, APIs, etc so I hope this isn't a dumb question.

I'm trying to access my schools AGOL organization from Jupyter notebooks using:

 

trouble72_0-1614289043160.png

 

But keep getting error 400, can not generate token/bad username or password.  I have tried all the variations on this I can think of (capitalization of my username as it appears in AGO, adding /portal to the organization url, etc) but nothing has worked.  Is it obvious to anyone here what I'm doing wrong?

I have no trouble logging in to AGO directly or through ArcGIS Pro with these same credentials. 

Thanks.

0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable

Hi Tim,

It sounds like you are using Enterprise Logins that have been configured with your ArcGIS Online organization, must likely OAuth2.0. That being the case, there is a slightly different workflow that is required to initialize a GIS object in the Python API. I would recommend you take a look at this section of the documentation for a sample workflow of how to accomplish this:

https://developers.arcgis.com/python/guide/working-with-different-authentication-schemes/#User-authe...

-Calvin

 

View solution in original post

5 Replies
by Anonymous User
Not applicable

Hello, 

I think the issue may be that you are appending /portal to the URL. The following should work:

gis=GIS("https://orgName.maps.arcgis.com", "username", "password")

gis=GIS("https://arcgis.com", "username", "password")

In the second option, you can enter in just arcgis.com and your username will automatically place you in the corresponding organization.

Also, it is worth noting that while signing into ArcGIS Online through a web browser or ArcGIS Pro is not case sensitive, making a GIS object through the ArcGIS API for Python is case sensitive. Make sure that you are using the username and password exactly as listed in your profile in your ArcGIS Online organization.

-Calvin

0 Kudos
Tim_Callahan
New Contributor II

Thank you for the reply Calvin. 

As you suggested I've tried dropping the /portal and quadruple checking that my username is capitalized as in the profile, but I get the same error. 

I think I may have identified the problem though.  When I normally log in to ArcGIS Online, I do so through the enterprise login option associated with my university.  Trying to log in via the ArcGIS login option in the sign-in window using my school credentials doesn't work.  So I guess that every time I sign in to ArcGIS Online I'm actually going through the school's system and they are passing different credentials than what I'm entering to satisfy the school login.

The process goes: open orgName.maps.arcgis.com -> choose the enterprise login on the sign-in screen -> enter my school credentials.

Sorry - there's probably better vocabulary to describe what I'm seeing.

-Tim

0 Kudos
DavinWalker2
Esri Contributor

Hi Tim,

If you normally use an Enterprise login the login details may have to be formatted like this DOMAIN\username for example edu\tim.callahan

by Anonymous User
Not applicable

Hi Tim,

It sounds like you are using Enterprise Logins that have been configured with your ArcGIS Online organization, must likely OAuth2.0. That being the case, there is a slightly different workflow that is required to initialize a GIS object in the Python API. I would recommend you take a look at this section of the documentation for a sample workflow of how to accomplish this:

https://developers.arcgis.com/python/guide/working-with-different-authentication-schemes/#User-authe...

-Calvin

 

Tim_Callahan
New Contributor II

Calvin,

Thanks for your help! The Oauth 2 client ID login method worked.  I would have been a very long time figuring that out.

Regards,

Tim

0 Kudos