AnonymousAccessTokenProvider constructor

AnonymousAccessTokenProvider({
  1. required String resource,
  2. Uri? authorizationUrl,
  3. Client? client,
})

Implementation

AnonymousAccessTokenProvider({required String resource, Uri? authorizationUrl, http.Client? client})
  : authorizationUrl = Uri.base.resolveUri(authorizationUrl ?? Uri.parse('/.well-known/meshagent/authorize')),
    _client = client {
  if (resource != 'room' && resource != 'agent') {
    throw ArgumentError.value(resource, 'resource', 'must be room or agent');
  }
  if (!['http', 'https'].contains(this.authorizationUrl.scheme)) {
    throw ArgumentError('anonymous authorization requires an HTTP(S) URL');
  }
  connectUrl = this.authorizationUrl.resolve('/.well-known/meshagent/$resource/connect');
}