PHP code example of keukenmagazijn / passport-authenticator
1. Go to this page and download the library: Download keukenmagazijn/passport-authenticator 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/ */
keukenmagazijn / passport-authenticator example snippets
return [
'passport' => [
'endpoints' => [
'base_uri' => env('APP_BASE_URI', null), // https://external.app
'authorize' => '/oauth/authorize', // Authorize our client and user route to retrieve a code.
'token' => '/oauth/token' // Route we give our code to and get our tokens from.
],
'user' => [
'email' => env('APP_USER_EMAIL', null), // username of external app.
'password' => env('APP_USER_PASSWORD', null), // password of external app.
],
'secret' => env('APP_SECRET', null), // API client secret used to connect.
'client_id' => env('APP_CLIENT_ID', null), // API client id used to connect .
'redirect_uri' => env('APP_REDIRECT_URI', null), // API redirect uri.
]
];
namespace App\Components\PassportAuthenticators\Instances;
use App\Components\PassportAuthenticators\Factories\ExampleFactory;
use Keukenmagazijn\PassportAuthenticator\Abstracts\ConcretePassportAuthenticator;
use Keukenmagazijn\PassportAuthenticator\Instances\Authenticator;
class ExampleAuthenticator extends ConcretePassportAuthenticator
{
/**
* We refer to the our factory here.
* @return Authenticator
*/
protected function getAuthenticatorInstance(): Authenticator
{
/** @var ExampleFactory $_factory */
$_factory = \App::make(ExampleFactory::class);
return $_factory->build();
}
/**
* @return string
*/
protected function getBaseUri(): string
{
return config('external_application.passport.endpoints.base_uri');
}
}