create static method

Future<OAuthApplicationCredential> create({
  1. required Uri portalUri,
  2. required String clientId,
  3. required String clientSecret,
  4. int tokenExpirationInterval = 0,
})

Creates an OAuthApplicationCredential with information needed to access an ArcGIS resource.

Parameters:

  • portalUri — The URL of the portal to authenticate with.
  • clientId — A unique identifier associated with an application registered with the portal that assists with client/server OAuth authentication.
  • clientSecret — A private key that verifies the application is authorized to access the registered service.
  • tokenExpirationInterval — The duration the token will remain valid, represented in minutes. The value must be greater than 0, otherwise the server default is used.

Return Value: Returns an OAuthApplicationCredential.

Implementation

static Future<OAuthApplicationCredential> create({
  required Uri portalUri,
  required String clientId,
  required String clientSecret,
  int tokenExpirationInterval = 0,
}) {
  _initializeArcGISEnvironmentIfNeeded();
  final corePortalUri = _CString(portalUri.toString());
  final coreClientId = _CString(clientId);
  final coreClientSecret = _CString(clientSecret);
  final taskHandle = _withThrowingErrorHandler((errorHandler) {
    return runtimecore.RT_OAuthApplicationCredential_createAsync(
      corePortalUri.bytes,
      coreClientId.bytes,
      coreClientSecret.bytes,
      tokenExpirationInterval,
      errorHandler,
    );
  });
  return taskHandle.toFuture(
    (element) => element.getValueAsOAuthApplicationCredential()!,
  );
}