Select to view content in your preferred language

ArcGIS Runtime 100.8 & Oauth2

07-20-2020 06:58 AM
Esri Contributor


I'm trying to use the following example, about oauth2 authentication

running this example without changes and after pop-up authentication, i can see every items that i've published

inside my webmap (basemap + a portal feature layer) in a private user and group defined for, when it was created the "application"


I read that should be possible, to use a Client Secret and change this type of authentication.

I would like to establish an authentication and authorization in background, by code, without an user interaction.

Every one could me suggest, which line should be modified on code in the example, to make it?

I've try to change the code in this way

      // If a client secret has been configured, set the authentication type to OAuthAuthorizationCode.
      if (!String.IsNullOrEmpty(ClientSecret))
        // Use OAuthAuthorizationCode if you need a refresh token (and have specified a valid client secret).
        serverInfo.TokenAuthenticationType = TokenAuthenticationType.OAuthClientCredentials;
        serverInfo.OAuthClientInfo.ClientSecret = ClientSecret;

but, when i run the example, i see my webmap with the selected basemap but my feature service it doesn't appear.

In the CreateCredentialAsync method, when "CredentialRequestInfo" is for my "Feature Layer" invoked  i see that the token generated its already expired and i don'n know why, maybe this could be the problem, how to solve?

I hope my problem it was well explained.

Thank you id advance.


0 Replies