fetchRemoteToken static method

Future<Map<String, dynamic>?> fetchRemoteToken({
  1. required String clientId,
  2. required String clientSecret,
  3. required String pkce,
  4. required String code,
})

Fetches the remote token that allows the user to connect to the bridge remotely.

This is step 2. Step 1 is BridgeDiscoveryService.remoteAuthRequest.

Implementation

static Future<Map<String, dynamic>?> fetchRemoteToken({
  required String clientId,
  required String clientSecret,
  required String pkce,
  required String code,
}) async {
  final Map<String, String> body = {
    "grant_type": "authorization_code",
    "code": code,
    "code_verifier": pkce,
  };

  return _fetchRemoteToken(
    clientId: clientId,
    clientSecret: clientSecret,
    body: body,
  );
}