Class OAuthTokenCredentialRequest
- 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
-
Constructor Summary
ConstructorDescriptionOAuthTokenCredentialRequest
(String baseUrl, RequestConfiguration requestConfiguration, String clientId, String redirectUri, String authCode) Instantiates a new OAuthTokenCredentialRequest with the specified parameters to request an OAuthTokenCredential.OAuthTokenCredentialRequest
(String baseUrl, RequestConfiguration requestConfiguration, String clientId, String redirectUri, String authCode, long expiration) Instantiates a new OAuthTokenCredentialRequest with the specified parameters to request an OAuthTokenCredential.OAuthTokenCredentialRequest
(String baseUrl, RequestConfiguration requestConfiguration, String clientId, String redirectUri, String authCode, long expiration, String codeVerifier, String codeChallenge, String codeChallengeMethod) Instantiates a new OAuthTokenCredentialRequest with the specified parameters to request an OAuthTokenCredential. -
Method Summary
Modifier and TypeMethodDescriptionAsynchronous computation to execute the request.static String
getAuthorizationUrl
(String baseUrl, String clientId, String redirectUri, long expiration) Returns the full URL for showing the OAuth login page and obtaining an authorization code.static String
getAuthorizationUrl
(String baseUrl, String clientId, String redirectUri, long expiration, String culture) Returns the full URL for showing the OAuth login page and obtaining an authorization code.static String
getAuthorizationUrl
(String baseUrl, String clientId, String redirectUri, long expiration, String culture, String codeChallenge, String codeChallengeMethod) Returns the full URL for showing the OAuth login page and obtaining an authorization code.
-
Constructor Details
-
OAuthTokenCredentialRequest
public OAuthTokenCredentialRequest(String baseUrl, RequestConfiguration requestConfiguration, String clientId, String redirectUri, 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(String baseUrl, RequestConfiguration requestConfiguration, String clientId, String redirectUri, 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(String baseUrl, RequestConfiguration requestConfiguration, String clientId, String redirectUri, String authCode, long expiration, String codeVerifier, String codeChallenge, 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 Details
-
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 String getAuthorizationUrl(String baseUrl, String clientId, 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 String getAuthorizationUrl(String baseUrl, String clientId, String redirectUri, long expiration, 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 String getAuthorizationUrl(String baseUrl, String clientId, String redirectUri, long expiration, String culture, String codeChallenge, 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
-