Autologin plugin for Craft CMS
Automatically login based on whitelisted IP, basic auth username or URL keys., (*1)
Installation
You can install Autologin via the plugin store, or through Composer., (*2)
Craft Plugin Store
To install Autologin, navigate to the Plugin Store section of your Craft control panel, search for Autologin
, and click the Try button., (*3)
Composer
You can also add the package to your project using Composer., (*4)
-
Open your terminal and go to your Craft project:, (*5)
cd /path/to/project
-
Then tell Composer to load the plugin:, (*6)
composer require verbb/autologin
-
In the Control Panel, go to Settings → Plugins and click the “Install” button for Autologin., (*7)
Configuring Autologin
The plugin is configured in the config/
directory in a file you create called autologin.php
. What follows is an example of what it might contain., (*8)
<?php
return [
// Enable the Autologin plugin
'enabled' => true,
// A list of Craft usernames/emails mapped to IPs
'ipWhitelist' => [
'craftUsername' => [
'162.247.141.58',
'162.247.141.59',
],
],
// A list of Craft usernames/emails mapped to basic auth usernames
'basicAuth' => [
'craftUserName1' => 'basicAuthUsername',
'craftUserName2' => 'basicAuthUsername2',
],
// A list of Craft usernames/emails mapped to url keys
'urlKeys' => [
'craftUserName' => 'BepmD8GQBZpaFpXQ',
],
// Redirect to this url after logging in automatically
'redirectUrl' => '',
];
Login by URL
You can provide your users with a url that automatically logs them in. To set this up, you need a pair of username => password in the urlKeys
setting., (*9)
After setting that up, you can login by going to siteurl.tld/autologin?key=BepmD8GQBZpaFpXQ
., (*10)
If you want to redirect to the control panel dashboard, add cp=true to the url: siteurl.tld/autologin?key=BepmD8GQBZpaFpXQ&cp=true
, (*11)
Credits
Originally created by the team at Superbig., (*12)
Show your Support
Autologin is licensed under the MIT license, meaning it will always be free and open source – we love free stuff! If you'd like to show your support to the plugin regardless, Sponsor development., (*13)
, (*14)