hostedCodeCapture method

String? hostedCodeCapture(
  1. String url
)

Attempts to extract the authorization code from the provided url. Returns the code, if found, otherwise null.

Implementation

String? hostedCodeCapture(String url) {
  if (!config.cognitoEnabled) {
    throw StateError('Cannot capture code with Cognito disabled.');
  }

  if (url.startsWith("myapp://?code=")) {
    return url.substring("myapp://?code=".length);
  }
  return null;
}