Mojolicious-Plugin-OAuth2-Server
view release on metacpan or search on metacpan
## oauth
Checks if there is a valid Authorization: Bearer header with a valid access
token and if the access token has the requisite scopes. The scopes are optional:
unless ( my $oauth_details = $c->oauth( @scopes ) ) {
return $c->render( status => 401, text => 'Unauthorized' );
}
This calls the [Net::OAuth2::AuthorizationServer::AuthorizationCodeGrant](https://metacpan.org/pod/Net%3A%3AOAuth2%3A%3AAuthorizationServer%3A%3AAuthorizationCodeGrant)
module (`verify_token_and_scope` method) to validate the access/refresh token.
## oauth2\_auth\_request
This is a helper to allow you get get the redirect URI instead of directing
a user to the authorize\_route - it requires the details of the client:
my $redirect_uri = $c->oauth2_auth_request({
client_id => $client_id,
redirect_uri => 'https://foo',
response_type => 'token',
=head2 oauth
Checks if there is a valid Authorization: Bearer header with a valid access
token and if the access token has the requisite scopes. The scopes are optional:
unless ( my $oauth_details = $c->oauth( @scopes ) ) {
return $c->render( status => 401, text => 'Unauthorized' );
}
This calls the L<Net::OAuth2::AuthorizationServer::AuthorizationCodeGrant>
module (C<verify_token_and_scope> method) to validate the access/refresh token.
=head2 oauth2_auth_request
This is a helper to allow you get get the redirect URI instead of directing
a user to the authorize_route - it requires the details of the client:
my $redirect_uri = $c->oauth2_auth_request({
client_id => $client_id,
redirect_uri => 'https://foo',
response_type => 'token',
lib/Mojolicious/Plugin/OAuth2/Server.pm view on Meta::CPAN
=head2 oauth
Checks if there is a valid Authorization: Bearer header with a valid access
token and if the access token has the requisite scopes. The scopes are optional:
unless ( my $oauth_details = $c->oauth( @scopes ) ) {
return $c->render( status => 401, text => 'Unauthorized' );
}
This calls the L<Net::OAuth2::AuthorizationServer::AuthorizationCodeGrant>
module (C<verify_token_and_scope> method) to validate the access/refresh token.
=head2 oauth2_auth_request
This is a helper to allow you get get the redirect URI instead of directing
a user to the authorize_route - it requires the details of the client:
my $redirect_uri = $c->oauth2_auth_request({
client_id => $client_id,
redirect_uri => 'https://foo',
response_type => 'token',
( run in 1.565 second using v1.01-cache-2.11-cpan-39bf76dae61 )