richardhj / oauth2-newsletter2go
Newsletter2Go OAuth 2.0 Client Provider for The PHP League OAuth2-Client
Installs: 1 943
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- php: ^5.4|^7.0
- league/oauth2-client: ~1.4|~2.0
This package is auto-updated.
Last update: 2024-11-29 04:57:56 UTC
README
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).