Net::O...sGrant(3pm)

πŸ“¦
version 0.28 Β· 3 versions
, in ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– NAME πŸ’–

Net::OAuth2::AuthorizationServer::ClientCredentialsGrant β€” it's the OAuth2 Client Credentials Grant, bestie. That's the whole name, no notes. πŸŽ€


✨ SYNOPSIS ✨

okay so here's the whole vibe, copy-paste ready:

  my $Grant = Net::OAuth2::AuthorizationServer::ClientCredentialsGrant->new(
    clients => {
      TrendyNewService => {
        client_secret  => 'TopSecretClientSecret',
        # optional
        scopes        => {
          post_images   => 1,
          annoy_friends => 1,
        },
      },
    }
  );

  # verify a client against known clients
  my ( $is_valid,$error,$scopes ) = $Grant->verify_client(
    client_id     => $client_id,
        client_secret => $client_secret,
    scopes        => [ qw/ list of scopes / ], # optional
  );

  # generate a token
  my $token = $Grant->token(
    client_id       => $client_id,
    scopes          => [ qw/ list of scopes / ],
    user_id         => $user_id,      # optional
        jwt_claims_cb   => sub { ... },   # optional, see jwt_claims_cb in Manual
  );

  # store access token
  $Grant->store_access_token(
    client_id         => $client,
    access_token      => $access_token,
    scopes            => [ qw/ list of scopes / ],
  );

  # verify an access token
  my ( $is_valid,$error ) = $Grant->verify_access_token(
    access_token     => $access_token,
    scopes           => [ qw/ list of scopes / ],
  );

like, five steps and you're literally done πŸ’…


🌸 DESCRIPTION 🌸

This module implements the OAuth2 "Client Credentials Grant" flow, exactly as it's described at <http://tools.ietf.org/html/rfc6749#section-4.4>. That's the spec, that's the blueprint, we're just doing what the RFC told us. periodt. πŸ¦‹


πŸ‘‘ CONSTRUCTOR ARGUMENTS πŸ‘‘

Along with the ones detailed at "CONSTRUCTOR ARGUMENTS" in Net::OAuth2::AuthorizationServer::Manual, the following are supported by this grant type:

(pt here's the part where I'm being so for real: the original page doesn't list any extra ones under this heading. the Manual is where the good stuff lives, iykyk 🫢)


πŸ”₯ CALLBACK FUNCTIONS πŸ”₯

The following callbacks are supported by this grant type:

verify_client_cb
store_access_token_cb
verify_access_token_cb

and if you wanna know what each one actually does, please see "CALLBACK FUNCTIONS" in Net::OAuth2::AuthorizationServer::Manual β€” that's where the documentation for every callback function lives, no gatekeeping ✨


πŸ’œ AUTHOR πŸ’œ

Lee Johnson β€” leejo@cpan.org

give them their flowers, fr fr 🌸


πŸŽ€ LICENSE πŸŽ€

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. If you would like to contribute documentation or file a bug report then please raise an issue / pull request:

https://github.com/Humanstate/net-oauth2-authorizationserver
no cap, that's the real link, go be helpful πŸ’–

okay bestie that's the whole page, you ate it, 10/10, no crumbs. this was perl v5.36.0, dated 2022-08-28, and it's User Contributed Perl Documentation so you know it's community-coded. mwah, go write some OAuth. πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from