Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/richardhj/oauth2-newsletter2go
Newsletter2Go OAuth 2.0 Client Provider for The PHP League OAuth2-Client
https://github.com/richardhj/oauth2-newsletter2go
newsletter newsletter2go oauth2 oauth2-client php-league
Last synced: 8 days ago
JSON representation
Newsletter2Go OAuth 2.0 Client Provider for The PHP League OAuth2-Client
- Host: GitHub
- URL: https://github.com/richardhj/oauth2-newsletter2go
- Owner: richardhj
- Created: 2016-08-22T15:38:57.000Z (about 8 years ago)
- Default Branch: v2.0
- Last Pushed: 2019-02-01T14:30:34.000Z (almost 6 years ago)
- Last Synced: 2024-05-07T03:02:53.157Z (6 months ago)
- Topics: newsletter, newsletter2go, oauth2, oauth2-client, php-league
- Language: PHP
- Size: 12.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# Newsletter2Go Provider for OAuth 2.0 Client
[![Latest Version on Packagist][ico-version]][link-packagist]
[![Software License][ico-license]]()
[![Dependency Status][ico-dependencies]][link-dependencies]This package provides Newsletter2Go OAuth 2.0 support for the PHP League's [OAuth 2.0 Client](https://github.com/thephpleague/oauth2-client).
## Install
Via Composer
``` bash
$ composer require richardhj/oauth2-newsletter2go
```## Usage
Use the auth key from your Newsletter2Go account to initiate the provider.
```php
$provider = new Richardhj\Newsletter2Go\OAuth2\Client\Provider\Newsletter2Go([
'authKey' => $authKey,
]);
```Then use your login credentials to fetch an AccessToken instance.
```php
$accessToken = $provider->getAccessToken(
'https://nl2go.com/jwt',
[
'username' => $username,
'password' => $password,
]
);
```### Refreshing a token
Initiate the provider as described before. Then:
```php
$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](https://docs.newsletter2go.com/#/Authorization) for reference.
## License
The GNU Lesser General Public License (LGPL).
[ico-version]: https://img.shields.io/packagist/v/richardhj/oauth2-newsletter2go.svg?style=flat-square
[ico-license]: https://img.shields.io/badge/license-LGPL-brightgreen.svg?style=flat-square
[ico-dependencies]: https://www.versioneye.com/php/richardhj:oauth2-newsletter2go/badge.svg?style=flat-square[link-packagist]: https://packagist.org/packages/richardhj/oauth2-newsletter2go
[link-dependencies]: https://www.versioneye.com/php/richardhj:oauth2-newsletter2go