1. Go to this page and download the library: Download blankogmbh/kirby-oauth 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/ */
blankogmbh / kirby-oauth example snippets
return [
//... other config options
'thathoff' => [
'oauth' => [
// Add your providers configuration here
'providers' => [
// for details see „Provider Options” below
],
// Only allow logins for existing kirby users (don’t create new users)
'onlyExistingUsers' => false,
// Set the default role of newly created users.
'defaultRole' => 'admin',
// Allow every valid user of all OAuth providers to login.
// For details see “Configure Allowed Users” below.
// DANGEROUS: Make sure you know what you’re doing when setting this to true!
'allowEveryone' => false,
// List of E-mail domains which are allowed to login
'domainWhitelist' => [
// For details see “Configure Allowed Users” below.
],
// List of E-mail addresses which are allowed to login
'emailWhitelist' => [
// For details see “Configure Allowed Users” below.
],
// Remove the standard Kirby login form and only display OAuth options.
'onlyOauth' => false,
],
],
];
//...
'providers' => [
'google' => [
'class' => "League\OAuth2\Client\Provider\Google", // use special google class from league/oauth2-google
'clientId' => 'somerandomstring.apps.googleusercontent.com',
'clientSecret' => 'clientsecret',
'icon' => 'users' // Pick any default Kirby icon for the login button (optional)
],
'custom' => [
// this one uses \League\OAuth2\Client\Provider\GenericProvider automatically
'name' => 'My Custom Provider' // The name is optional
'clientId' => 'demoapp', // The client ID assigned to you by the provider
'clientSecret' => 'demopass', // The client password assigned to you by the provider
'redirectUri' => 'https://example.com/your-redirect-url/',
'urlAuthorize' => 'https://example.com/oauth2/lockdin/authorize',
'urlAccessToken' => 'https://example.com/oauth2/lockdin/token',
'urlResourceOwnerDetails' => 'https://example.com/oauth2/lockdin/resource',
'icon' => 'users' // Pick any default Kirby icon for the login button (optional)
],
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.