Class OAuthTokenCredentialRequest
- java.lang.Object
-
- com.esri.arcgisruntime.security.OAuthTokenCredentialRequest
-
public final class OAuthTokenCredentialRequest extends java.lang.Object
Performs a request to retrieve an OAuthTokenCredential. Provided a URL, client ID, redirect URI (optional), expiration (optional) and authorization code, access and refresh tokens will be fetched and returned as an OAuthTokenCredential. The general workflow is:- Call
getAuthorizationUrl(String, String, String, long)
to build the URL for showing the OAuth login page. - Start an intent to show the URL in a device-installed web browser, which will redirect back to the app.
- Pass the returned authorization code to the OAuthTokenCredentialRequest constructor.
- Call
executeAsync()
to fetch the OAuthTokenCredential.
- Since:
- 100.0.0
- Call
-
-
Constructor Summary
Constructors Constructor Description OAuthTokenCredentialRequest(java.lang.String baseUrl, RequestConfiguration requestConfiguration, java.lang.String clientId, java.lang.String redirectUri, java.lang.String authCode)
Instantiates a new OAuthTokenCredentialRequest with the specified parameters to request an OAuthTokenCredential.OAuthTokenCredentialRequest(java.lang.String baseUrl, RequestConfiguration requestConfiguration, java.lang.String clientId, java.lang.String redirectUri, java.lang.String authCode, long expiration)
Instantiates a new OAuthTokenCredentialRequest with the specified parameters to request an OAuthTokenCredential.OAuthTokenCredentialRequest(java.lang.String baseUrl, RequestConfiguration requestConfiguration, java.lang.String clientId, java.lang.String redirectUri, java.lang.String authCode, long expiration, java.lang.String codeVerifier, java.lang.String codeChallenge, java.lang.String codeChallengeMethod)
Instantiates a new OAuthTokenCredentialRequest with the specified parameters to request an OAuthTokenCredential.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ListenableFuture<OAuthTokenCredential>
executeAsync()
Asynchronous computation to execute the request.static java.lang.String
getAuthorizationUrl(java.lang.String baseUrl, java.lang.String clientId, java.lang.String redirectUri, long expiration)
Returns the full URL for showing the OAuth login page and obtaining an authorization code.static java.lang.String
getAuthorizationUrl(java.lang.String baseUrl, java.lang.String clientId, java.lang.String redirectUri, long expiration, java.lang.String culture)
Returns the full URL for showing the OAuth login page and obtaining an authorization code.static java.lang.String
getAuthorizationUrl(java.lang.String baseUrl, java.lang.String clientId, java.lang.String redirectUri, long expiration, java.lang.String culture, java.lang.String codeChallenge, java.lang.String codeChallengeMethod)
Returns the full URL for showing the OAuth login page and obtaining an authorization code.
-
-
-
Constructor Detail
-
OAuthTokenCredentialRequest
public OAuthTokenCredentialRequest(java.lang.String baseUrl, RequestConfiguration requestConfiguration, java.lang.String clientId, java.lang.String redirectUri, java.lang.String authCode)
Instantiates a new OAuthTokenCredentialRequest with the specified parameters to request an OAuthTokenCredential.- Parameters:
baseUrl
- the base URL of the portalrequestConfiguration
- the request configuration to apply to this requestclientId
- the client ID that was registered for this applicationredirectUri
- the redirect URI to follow during the authorization workflow (optional)authCode
- the authorization code retrieved from the authorization URL- Since:
- 100.0.0
-
OAuthTokenCredentialRequest
public OAuthTokenCredentialRequest(java.lang.String baseUrl, RequestConfiguration requestConfiguration, java.lang.String clientId, java.lang.String redirectUri, java.lang.String authCode, long expiration)
Instantiates a new OAuthTokenCredentialRequest with the specified parameters to request an OAuthTokenCredential. The refresh token can be valid for 90 days or the maximum limit set at the ArcGISOnline organisation level (whichever is minimum). For a permanent refresh token (if the portal supports it), use -1. Make sure to specify the same expiration of refresh token which was used in the call togetAuthorizationUrl(String, String, String, long)
to build the URL for showing the OAuth login page.- Parameters:
baseUrl
- the base URL of the portalrequestConfiguration
- the request configuration to apply to this requestclientId
- the client ID that was registered for this applicationredirectUri
- the redirect URI to follow during the authorization workflow (optional)authCode
- the authorization code retrieved from the authorization URLexpiration
- the desired expiration of the refresh token in minutes, 0 for default expiry time or -1 for a permanent refresh token- Since:
- 100.5.0
-
OAuthTokenCredentialRequest
public OAuthTokenCredentialRequest(java.lang.String baseUrl, RequestConfiguration requestConfiguration, java.lang.String clientId, java.lang.String redirectUri, java.lang.String authCode, long expiration, java.lang.String codeVerifier, java.lang.String codeChallenge, java.lang.String codeChallengeMethod)
Instantiates a new OAuthTokenCredentialRequest with the specified parameters to request an OAuthTokenCredential. The refresh token can be valid for 90 days or the maximum limit set at the ArcGISOnline organisation level (whichever is minimum). For a permanent refresh token (if the portal supports it), use -1. Make sure to specify the same expiration of refresh token which was used in the call togetAuthorizationUrl(String, String, String, long)
to build the URL for showing the OAuth login page.- Parameters:
baseUrl
- the base URL of the portalrequestConfiguration
- the request configuration to apply to this requestclientId
- the client ID that was registered for this applicationredirectUri
- the redirect URI to follow during the authorization workflow (optional)authCode
- the authorization code retrieved from the authorization URLexpiration
- the desired expiration of the refresh token in minutes, 0 for default expiry time or -1 for a permanent refresh tokencodeVerifier
- the PKCE code verifier string, or null if PKCE is not supported by the PortalcodeChallenge
- the PKCE code challenge string, or null if PKCE is not supported by the PortalcodeChallengeMethod
- the PKCE code challenge method string, or null if PKCE is not supported by the Portal- Since:
- 100.12.0
-
-
Method Detail
-
executeAsync
public ListenableFuture<OAuthTokenCredential> executeAsync()
Asynchronous computation to execute the request. The result is an OAuthTokenCredential.- Returns:
- a ListenableFuture for tracking when the computation is done and getting the result
- Since:
- 100.0.0
-
getAuthorizationUrl
public static java.lang.String getAuthorizationUrl(java.lang.String baseUrl, java.lang.String clientId, java.lang.String redirectUri, long expiration)
Returns the full URL for showing the OAuth login page and obtaining an authorization code. Use this method, in preference to the overload that takes an extra parameter 'culture', to use the current culture set on the device/machine.The refresh token can be valid for 90 days or the maximum limit set at the ArcGISOnline organisation level (whichever is minimum). For a permanent refresh token (if the portal supports it), use -1. Make sure to specify the same expiration of refresh token when instantiating a new
OAuthTokenCredentialRequest(String, RequestConfiguration, String, String, String, long)
.- Parameters:
baseUrl
- the base URL of the portalclientId
- the registered client ID of this applicationredirectUri
- the redirect URI to follow throughout the authorization workflow, or null to use the defaultexpiration
- the desired expiration of the refresh token in minutes, 0 for default expiry time or -1 for a permanent refresh token- Returns:
- the full URL for the authorization page
- Since:
- 100.0.0
-
getAuthorizationUrl
public static java.lang.String getAuthorizationUrl(java.lang.String baseUrl, java.lang.String clientId, java.lang.String redirectUri, long expiration, java.lang.String culture)
Returns the full URL for showing the OAuth login page and obtaining an authorization code. Use this method, in preference to the overload that does not take a 'culture' parameter, if you do not want to use the current culture set on the device/machine.The refresh token can be valid for 90 days or the maximum limit set at the ArcGISOnline organisation level (whichever is minimum). For a permanent refresh token (if the portal supports it), use -1. Make sure to specify the same expiration of refresh token when instantiating a new
OAuthTokenCredentialRequest(String, RequestConfiguration, String, String, String, long)
.- Parameters:
baseUrl
- the base URL of the portalclientId
- the registered client ID of this applicationredirectUri
- the redirect URI to follow throughout the authorization workflow, or null to use the defaultexpiration
- the desired expiration of the refresh token in minutes, 0 for default expiry time or -1 for a permanent refresh tokenculture
- the culture code corresponding to the language to be used on the OAuth login page, for example "en-US", or null to allow the language to be determined by the portal/organization settings- Returns:
- the full URL for the authorization page
- Since:
- 100.9.0
-
getAuthorizationUrl
public static java.lang.String getAuthorizationUrl(java.lang.String baseUrl, java.lang.String clientId, java.lang.String redirectUri, long expiration, java.lang.String culture, java.lang.String codeChallenge, java.lang.String codeChallengeMethod)
Returns the full URL for showing the OAuth login page and obtaining an authorization code. Use this method, in preference to the overload that does not take a 'culture' parameter, if you do not want to use the current culture set on the device/machine.The refresh token can be valid for 90 days or the maximum limit set at the ArcGISOnline organisation level (whichever is minimum). For a permanent refresh token (if the portal supports it), use -1. Make sure to specify the same expiration of refresh token when instantiating a new
OAuthTokenCredentialRequest(String, RequestConfiguration, String, String, String, long)
.- Parameters:
baseUrl
- the base URL of the portalclientId
- the registered client ID of this applicationredirectUri
- the redirect URI to follow throughout the authorization workflow, or null to use the defaultexpiration
- the desired expiration of the refresh token in minutes, 0 for default expiry time or -1 for a permanent refresh tokenculture
- the culture code corresponding to the language to be used on the OAuth login page, for example "en-US", or null to allow the language to be determined by the portal/organization settingscodeChallenge
- the PKCE code challenge string, or null if PKCE is not supported by the PortalcodeChallengeMethod
- the PKCE code challenge method string, or null if PKCE is not supported by the Portal- Returns:
- the full URL for the authorization page
- Since:
- 100.12.0
-
-