This package provides Newsletter2Go OAuth 2.0 support for the PHP League's OAuth 2.0 Client.
Via Composer
$ composer require richardhj/oauth2-newsletter2go
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,
]
);
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.
The GNU Lesser General Public License (LGPL).