Help with OAuth

2100
30
Jump to solution
10-04-2023 11:30 AM
BrianBulla1
Occasional Contributor

Hi,

I'm just starting with the Maps SDK today, so sorry in advance for the stupid questions.  🙂

So I'm trying to do something that I think should be super simple, but I cannot for the life of me get it to work.  I'm using the DisplayAMap sample, changing the portal item to one under my AGOL account, and trying to display it.  The missing componenet is the OAuth, since I'll need to enter a username/password to get to the webmap.

I'm looking at the "Secutrity" samples in the .NET WPF app, but don't quite understand how to integrate it into what I already have working in the DisplayAMap Sample.

There seems to be this "ArcGISLoginPrompt.cs" file, that doesn't display the code for in the app.  I'm guessing that's an important part of it??

Sorry for the cryptic question....I just have no clue what to even ask.

0 Kudos
30 Replies
ThadTilton
Esri Contributor

As for the differences between the tutorial and sample code, they're actually doing the same thing. In fact, the AuthenticationHelper class in the tutorial is based on the ArcGISLoginPrompt class used in the sample.

The essential code from that class was used in the tutorial and simplified as much as possible. For example, the RegisterSecureServer function in the tutorial is a simplified version of the sample's SetChallengeHandler function (the lines in that function to set the ChallengeHander and OAuthAuthorizeHander were simply added to the AuthenticationHelper's constructor in the tutorial version). PromptCredentialAsync() are identical in both, as is the OAuthAuthorizeHandler class.

It's worth exploring why they seem to be behaving differently. Perhaps there are some key differences outside this code that contribute to that.