1. Go to this page and download the library: Download mfc/oauth2 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/ */
mfc / oauth2 example snippets
Mfc\OAuth2\ResourceServer\Registry::addServer(
'gitlab', // identifier for the Resource Server
'Login with GitLab', // Text displayed on the Login Screen
\Mfc\OAuth2\ResourceServer\GitLab::class,
[
'enabled' => true, // Enable/Disable the provider
'arguments' => [
'appId' => 'your-app-id',
'appSecret' => 'your-app-secret',
'gitlabServer' => 'https://gitlab.com', // Your GitLab Server
'gitlabAdminUserLevel' => \Mfc\OAuth2\ResourceServer\GitLab::USER_LEVEL_DEVELOPER, // User level at which the user will be given admin permissions
'gitlabDefaultGroups' => '0', // Groups to assign to the User (comma separated list possible)
'gitlabUserOption' => 0, // UserConfig
'blockExternalUser' => false, // Blocks users with flag external from access the backend
'projectName' => 'your/repo', // the repository from which user information is fetched
],
]
);
Mfc\OAuth2\ResourceServer\Registry::addServer(
'example-provider', // identifier for the Resource Server
'Login with Example', // Text displayed on the Login Screen
\Just\AnExample\Providers\ExampleProvider::class,
[
'enabled' => true, // Enable/Disable the provider
'arguments' => [
'yourarg' => 'somevalue',
// ...
],
]
);