authenticate static method

Future<TokenResponse> authenticate()

Initiate authentication via the OIDC authorization code flow for public clients.

An app implementing the Embedded SDK initiates an authentication request with Beyond Identity. Using the public client API assumes that there is no secure backend storing the client secret for the app.

Returns the access and ID tokens, plus expiration times in a TokenResponse object.

Implementation

static Future<TokenResponse> authenticate() async {
  final Map<String, dynamic>? tokenMap = await _channel.invokeMapMethod('authenticate');

  try {
    return TokenResponse(
      accessToken: tokenMap?["accessToken"],
      idToken: tokenMap?["idToken"],
      tokenType: tokenMap?["tokenType"],
      expiresIn: tokenMap?["expiresIn"],
    );
  } on Exception {
    rethrow;
  }
}