Function OAuthWebapp.login
Perform OAuth login using the given settings
bool login
(
scope vibe .http .server .HTTPServerRequest req,
scope vibe .http .server .HTTPServerResponse res,
immutable(OAuthSettings) settings,
in const(string[string]) extraParams,
in const(string[]) scopes = null
) @safe;
bool login
(
scope vibe .http .server .HTTPServerRequest req,
scope vibe .http .server .HTTPServerResponse res,
immutable(OAuthSettings) settings,
in const(string[]) scopes
) @safe;
The route mapped to this method should normally match the redirectUri set on the settings. If multiple providers are to be supported, there should be a different route for each provider, all mapped to this method, but with different settings.
If the request looks like a redirect back from the authentication server, settings.userSession is called to obtain an OAuthSession.
Otherwise, the user agent is redirected to the authentication server.
Parameters
Name | Description |
---|---|
req | The request |
res | Response object to be used to redirect the client to the authentication server |
settings | The OAuth settings that apply to this login attempt |
scopes | (Optional) An array of identifiers specifying the scope of the authorization requested. |
Returns
true
if a OAuth session was obtained and
false
if no OAuth session is present and a redirect to an
OAuth provider will happen.