Problems with Qml Portal Login Authentication

1904
4
Jump to solution
07-27-2018 07:40 AM
KeithLarson1
MVP

Hello all,

I want to prompt the user to log in with their ArcGIS Online account when my app starts up. I get their login information and load the Portal, which causes an authenitcationChallenge signal to be called by an AuthenticationManager. So, I connect to the signal and pass it the username and password, and it works fine if they enter the correct information. The problem is when they enter in invalid login information, it fails to load the Portal, and when the user puts in the correct login information, I do a retryLoad() on the Portal, and it fails because the authenticationChallenge doesn't get called. Also, it gives me the error that too many invalid logins have been attempted, but I am sure the issue is that I am not sble to pass the Portal the correct username and password because the authenticationChellenge doesn't ever come up after the first load of the Portal.

Does anyone know how I could get the authenticationChallenge to come back after the first Portal load attempt? Any help would be appreciated.

Thanks,

Keith

0 Kudos
1 Solution

Accepted Solutions
TinaJin
Esri Regular Contributor

Hi Keith,

I am not sure if this will help,  you can try to cancel authentication challenge before opening a new OAuth login page

    AuthenticationView {
        id: authenticationView
        authenticationManager: AuthenticationManager
    }
     authenticationView.authChallenge.cancel();

We also have two samples related to Portal log in.  
You can search for "OAuth + Biometric Authentication" and "Portal User Info" in the 
AppStudio Desktop New App dialog 





View solution in original post

0 Kudos
4 Replies
ErwinSoekianto
Esri Regular Contributor

Hello Keith, 

Have you looked at our sample our implementation for Portal login (OAuth2) implementation in one of our templates? 

For examples in MapViewer template, you can look at 

  • MapViewer/MapViewer/MapViewerApp.qml around line 360-ish under the comment //--PORTAL---
  • MapViewer/MapViewer/views/OAuth2View.qml file

You should be able to follow how to handle such scenarios when someone fails to login.

Thank you,

Erwin

0 Kudos
KeithLarson1
MVP

Thanks for your reply. I got it working with the AuthenticationView, so all is good now.

0 Kudos
TinaJin
Esri Regular Contributor

Hi Keith,

I am not sure if this will help,  you can try to cancel authentication challenge before opening a new OAuth login page

    AuthenticationView {
        id: authenticationView
        authenticationManager: AuthenticationManager
    }
     authenticationView.authChallenge.cancel();

We also have two samples related to Portal log in.  
You can search for "OAuth + Biometric Authentication" and "Portal User Info" in the 
AppStudio Desktop New App dialog 





0 Kudos
KeithLarson1
MVP

Ok, thanks. I wasn't using the AuthenticationManager before because I hadn't imported Esri.ArcGISRuntime.Toolkit.Dialogs. I was able to get it to work with the AuthenticationView though, so all is good. Thanks again.

0 Kudos