Business-TrueLayer

 view release on metacpan or  search on metacpan

lib/Business/TrueLayer/Authenticator.pm  view on Meta::CPAN

        $self->_auth_token
        && $self->_token_type
        && ! $self->_token_is_expired
    ) {
        return $self;
    }

    my $url = "https://" . $self->host . "/connect/token";
    my $json = JSON->new->utf8->canonical->encode(
        {
            grant_type    => 'client_credentials',
            client_id     => $self->client_id,
            client_secret => $self->client_secret,
            scope         => join( " ",$self->scope->@* ),
        }
    );

    my $res_content = $self->_ua_request( $url, $json );

    # If any of these are missing, we get "interesting" errors from Moose
    # constraint violations.

xt/README  view on Meta::CPAN

to run the author tests you will need a .json file that describes the
config as so:

    /path/to/working/business-truelayer > cat business-truelayer-credentials.json
    {
        "application_name" : "your_test_application_name",
        "client_id" : "your_client_id"",
        "client_secret" : "your_client_secret"",
        "host" : "truelayer-sandbox.com",
        "api_host" : "api.truelayer-sandbox.com",
        "auth_host" : "auth.truelayer-sandbox.com",
        "kid" : "your_kid"",
        "private_key" : "/path/to/working/business-truelayer/your-ec512-private-key.pem"
    }

you will need to update the various values as defined by your sandbox
setup, and create yourself a private and public key (see TrueLayer's)
docs for that

having created that you can run:

    TRUELAYER_CREDENTIALS=business-truelayer-credentials.json prove -lr xt/



( run in 0.731 second using v1.01-cache-2.11-cpan-4d50c553e7e )