CorbadoPasskeyBackend constructor

CorbadoPasskeyBackend(
  1. String _projectID
)

Sets up the client for the Corbado API.

Implementation

CorbadoPasskeyBackend(this._projectID)
    : _client =
          ApiClient(basePath: 'https://$_projectID.frontendapi.corbado.io'),
      _authenticator = PasskeyAuthenticator() {
  _client.addDefaultHeader('X-Corbado-Project-ID', _projectID);
  debugPrint('CorbadoPasskeyBackend: $_projectID');

  if (Platform.isAndroid) {
    _authenticator.getFacetID().then(
          (value) => {
            debugPrint('setting Origin of API requests to $value'),
            _client.addDefaultHeader('Origin', value),
          },
        );
  } else if (Platform.isIOS) {
    _client.addDefaultHeader(
      'Origin',
      'https://$_projectID.frontendapi.corbado.io',
    );
  }
}