createAuthenticationRequestUrl function
Create a URL that can be used to redirect the browser to request authentication (e.g. using the authentication provider). Will throw if some options are invalid. @param options An option with all options for the authentication request.
Implementation
Uri createAuthenticationRequestUrl(CreateUrlOptions options) {
var url = Uri.parse(
options.identityProvider?.toString() ?? DEFAULT_IDENTITY_PROVIDER_URL);
url.queryParameters.addEntries([
const MapEntry('response_type', 'token'),
MapEntry('login_hint', options.publicKey.toDer().toHex()),
MapEntry('redirect_uri', options.redirectUri ?? _getDefaultLocation()),
MapEntry(
'scope',
options.scope
.map((p) {
if (p is String) {
return Principal.fromText(p);
} else {
return p;
}
})
.map((p) => p.toString())
.join(' '),
),
const MapEntry('state', '')
]);
return url;
}