drewhammond/oauth2-availity

Availity Provider for OAuth2 client

0.2.0 2018-02-21 16:20 UTC

This package is not auto-updated.

Last update: 2024-11-10 06:21:04 UTC


README

Build Status License Latest Stable Version

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

Installation

To install, use composer:

$ composer require drewhammond/oauth2-availity

Usage

The example below is taken from a Laravel project with the AVAILITY_CLIENT_ID and AVAILITY_CLIENT_SECRET defined in the project .env file.

  // Instantiate Availity provider
  $provider = new \Drewhammond\OAuth2\Client\Provider\Availity( [
    'clientId'     => getenv( 'AVAILITY_CLIENT_ID' ),
    'clientSecret' => getenv( 'AVAILITY_CLIENT_SECRET' ),
  ] );

  // Fetch access token using client_credentials grant (only grant type supported by Availity)
  $accessToken = $provider->getAccessToken( 'client_credentials' );

  // Do something with your access token...
  $token   = $accessToken->getToken();
  $expires = $accessToken->getExpires();

Support

Please open a new issue if you run into any problems.

License

MIT License

Copyright (c) 2018 Drew Hammond