authorize static method
GET /oauth/authorize: a valid request is sent to the consent screen
with its parameters; an unknown client or unregistered redirect URI is
shown and never redirected; any other error goes back to the client.
Implementation
static Future<Response> authorize(Request request) => _guard(() async {
final DVOAuthProvider? provider = await _provider();
if (provider == null) return _notServed();
final _Validated v = await _validate(
provider,
request.url.queryParametersAll,
);
final DVOAuthError? error = v.error;
if (error != null) {
final String? back = v.errorRedirect;
if (back == null) {
return _text(
400,
'The authorization request is invalid (${error.error}).',
);
}
return _redirect(back);
}
return _redirect(
Uri(path: consentPath, queryParameters: v.query).toString(),
);
}, json: false);