PHP code example of krdinesh / laravel-oauth2-smartrecruiters
1. Go to this page and download the library: Download krdinesh/laravel-oauth2-smartrecruiters library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
krdinesh / laravel-oauth2-smartrecruiters example snippets
php
Krdinesh\Laravel\OAuth2\SmartRecruiters\SmartRecruitersServiceProvider::class
php
'SmartRecruiters' => Krdinesh\Laravel\OAuth2\SmartRecruiters\Facades\SmartRecruiters::class
bash
php artisan vendor:publish
php
$authUrl = SmartRecruiters::authorize([], function ($url, $provider) use ($request) {
$request->session()->put('smartrecruitersState', $provider->getState());
return $url;
});
return redirect()->away($authUrl);
php
if (!$request->has('state') || $request->state !== $request->session()->get('smartrecruitersState')) {
abort(400, 'Invalid state');
}
if (!$request->has('code')) {
abort(400, 'Authorization code not available');
}
$token = SmartRecruiters::getAccessToken('authorization_code', [
'code' => $request->code,
]);
$token->getToken();