A credential that access OAuth token-secured ArcGIS resources using an Authentication::OAuthUserConfiguration. More...
| Header | #include <Authentication/ |
| Since | Esri |
| Inherits | Esri |
Public Functions
| virtual | ~ |
| QString | authorization |
| Esri | configuration() const |
| QFuture | revoke |
| QFuture | token |
Static Public Members
| QFuture | create |
Detailed Description
The OAuth user credential generates a short-lived access token that gives the user permission to access token-secured ArcGIS content and services, such as the ArcGIS location services.
To configure the lifetime of this credential, set the desired refresh token expiration and exchange intervals on the Authentication::OAuthUserConfiguration.
- The refresh token expires after 14 days and is exchanged every 24 hours, allowing users to remain logged in unless the app is unused for the entire two-week period.
- Set the exchange interval to 0 to ensure users must log in again once the refresh token expires.
Creating this credential displays an OAuth login page to the user. To customize the appearance of the login page, adjust parameters such as Authentication::OAuthUserConfiguration::isShowCancelButton or Authentication::OAuthUserConfiguration::userInterfaceStyle.
If you use this Authentication::OAuthUserCredential as part of the secure resource challenge handling, it will be stored in the Authentication::ArcGISCredentialStore of the Authentication::AuthenticationManager. It will be used by all subsequent requests that have a matching URL context.
Member Function Documentation
[override virtual noexcept] OAuthUserCredential::~OAuthUserCredential ()
Destructor.
QString OAuthUserCredential::authorizationCode () const
Returns an authorization code to generate the OAuth token.
Esri::ArcGISRuntime::Authentication::OAuthUserConfiguration *OAuthUserCredential::configuration() const
Returns the OAuth configuration details of an application that can sign into an ArcGIS Online or ArcGIS Enterprise portal using OAuth.
See also Register Your Application.
[static] QFuture<Esri::ArcGISRuntime::Authentication::OAuthUserCredential *> OAuthUserCredential::createAsync (Esri::ArcGISRuntime::Authentication::OAuthUserConfiguration *configuration, QObject *parent = nullptr)
Creates an OAuthUserCredential with information needed to access an ArcGIS resource. This initiates the OAuth login process by presenting the OAuth login page.
- configuration - The OAuth configuration details of an application that can sign into an ArcGIS Online or ArcGIS Enterprise portal using OAuth.
- parent - An optional parent.
This method returns a QFuture for the asynchronous operation. Use future.then() to continue processing when the operation completes. Use future.onFailed() to handle exceptions of type ErrorException.
See Working with QFuture for further details.
QFuture<void> OAuthUserCredential::revokeTokenAsync ()
Sends a network request to revoke OAuth refresh and access tokens.
This call will fail if the tokens have not been successfully revoked.
This method returns a QFuture for the asynchronous operation. Use future.then() to continue processing when the operation completes. Use future.onFailed() to handle exceptions of type ErrorException.
See Working with QFuture for further details.
QFuture<Esri::ArcGISRuntime::Authentication::OAuthUserTokenInfo *> OAuthUserCredential::tokenInfoAsync (QObject *parent = nullptr)
Returns an instance of OAuthUserTokenInfo generated by this credential, with an optional parent.
If the access token has expired, this method regenerates it.
If Authentication::OAuthUserConfiguration::refreshTokenExchangeInterval is set, this method exchanges the refresh token at the specified interval. By default, the interval is 1440 minutes (24 hours).
While regenerating the access token or exchanging the refresh token, if the refresh token is expired, an invalid token error is returned.
This method returns a QFuture for the asynchronous operation. Use future.then() to continue processing when the operation completes. Use future.onFailed() to handle exceptions of type ErrorException.
See Working with QFuture for further details.