Skip to content

Newsletter2Go OAuth 2.0 Client Provider for The PHP League OAuth2-Client

Notifications You must be signed in to change notification settings

richardhj/oauth2-newsletter2go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Newsletter2Go Provider for OAuth 2.0 Client

Latest Version on Packagist Software License Dependency Status

This package provides Newsletter2Go OAuth 2.0 support for the PHP League's OAuth 2.0 Client.

Install

Via Composer

$ composer require richardhj/oauth2-newsletter2go

Usage

Use the auth key from your Newsletter2Go account to initiate the provider.

$provider = new Richardhj\Newsletter2Go\OAuth2\Client\Provider\Newsletter2Go([
    'authKey' => $authKey,
]);

Then use your login credentials to fetch an AccessToken instance.

$accessToken = $provider->getAccessToken(
    'https://nl2go.com/jwt',
    [
        'username' => $username,
        'password' => $password,
    ]
);

Refreshing a token

Initiate the provider as described before. Then:

$accessToken = $provider->getAccessToken(
    'https://nl2go.com/jwt_refresh',
    [
        'refresh_token' => $accessToken->getRefreshToken()
    ]
);

It is recommended to save the refresh_token ($refreshToken = $accessToken->getRefreshToken()) in your application rather than the username and password. Nevertheless: Handle with care!

Visit the official API documentation for reference.

License

The GNU Lesser General Public License (LGPL).