New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

krdinesh/laravel-oauth2-greenhouse

A Laravel 5.2 service provider for league/oauth2-greenhouse
342
Install
composer require krdinesh/laravel-oauth2-greenhouse
Latest Version:v1.0.1
PHP:>=5.5.9
Laravel:5
License:MIT
Last Updated:Oct 11, 2017
Links: GitHub  ·  Packagist
Maintainer: dkthelearner

krdinesh/laravel-oauth2-greenhouse

krdinesh/laravel-oauth2-greenhouse is a Laravel 5.2 service provider for krdinesh/oauth2-greenhouse.

Installation

The preferred method of installation is via Packagist and Composer. Run the following command to install the package and add it as a requirement to your project's composer.json:

composer require krdinesh/laravel-oauth2-greenhouse

After requiring the package with Composer, you'll need to add the following to the providers array in config/app.php:

Krdinesh\Laravel\OAuth2\Greenhouse\GreenhouseServiceProvider::class

Then, add the following to the aliases array in the same file:

'Greenhouse' => Krdinesh\Laravel\OAuth2\Greenhouse\Facades\Greenhouse::class

Now, run the following to properly set up the package with your Laravel application:

php artisan vendor:publish

Finally, Add your client ID, client secret, and redirect URI to config/greenhouse.php.

Examples

Create an authorization URL and redirect users to it in order to request access to their Greenhouse account:

$authUrl = Greenhouse::authorize([], function ($url, $provider) use ($request) {
    $request->session()->put('greenhouseState', $provider->getState());
    return $url;
});

return redirect()->away($authUrl);

In the route for the redirect URI, check the state and authorization code, and use the code to get an access token. Store the token to the session or to the user's profile in your data store.

if (!$request->has('state') || $request->state !== $request->session()->get('greenhouseState')) {
    abort(400, 'Invalid state');
}

if (!$request->has('code')) {
    abort(400, 'Authorization code not available');
}

$token = Greenhouse::getAccessToken('authorization_code', [
    'code' => $request->code,
]);

$token->getToken();

The krdinesh/laravel-oauth2-greenhouse library is copyright ©Dinesh kumar and licensed for use under the MIT License (MIT). Please see LICENSE for more information.

Related Packages

taylorotwell/laravel-oauth2

Please don't use this package anymore. Use madewithlove/laravel-oauth2 instead.

663 4
prakashdivyy/laravel-oauth2-ui

A Laravel 5 service provider for prakashdivyy/oauth2-ui

124 0
leoru/laravel-oauth2

Authorize users in your application with multiple OAuth 2.0 providers.

70 5
adprocas/laravel-oauth2

Authorize users in your application with multiple OAuth 2.0 providers.

58 1
onex/oauth2-server-lumen

An OAuth 2.0 bridge for Laravel and Lumen

15 1

Version History

Version Released PHP Laravel License
v1.0.1 >=5.5.9 ^5.2 MIT
v1.0.0 >=5.5.9 ^5.2 MIT