componentk / shopware6-admin-auto-login
Designed for developer environment Shopware 6 only. Just auto logs in using the default admin user/pass
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:shopware-platform-plugin
pkg:composer/componentk/shopware6-admin-auto-login
Requires
- shopware/core: ~6.7.0
README
Auto‑login override for the Shopware 6 Administration login page, intended for local development only.
What It Does
- On GET to the admin path (e.g.
/admin), requests an OAuth token using the default credentialsadmin/shopware. - Writes a
bearerAuthcookie (root path and admin path) and redirects to the Administration dashboard. - If a valid
bearerAuthcookie already exists, it does nothing. - Provides an API endpoint
/api/_action/ckou-auto-loginfor manual authentication (useful with admin watcher).
Requirements
- Shopware
>= 6.7.0. - An admin user with username
adminand passwordshopwarein your dev environment. APP_URLenvironment variable set to your base URL (defaults tohttp://localhost:8000).
Install & Activate
- Copy this plugin to
custom/plugins/CKOUAdminAutoLogin. - Run:
bin/console plugin:refresh - Activate:
bin/console plugin:install --activate CKOUAdminAutoLogin
Usage
The plugin provides seamless auto-login for both standard admin access and the admin watcher (Vite dev server).
Recommended Workflow (Admin Watcher)
The plugin automatically handles everything! Just use port 8000 URLs:
Simple access:
http://localhost:8000/admin
→ Auto-login
→ Detects watcher running
→ Redirects to http://localhost:5173/#/sw/dashboard/index
Deep links (hash/path preserved):
http://localhost:8000/admin#/sw/customer/detail/019a24bdea5d71158ac12e3f9ef465be/documents?edit=false
→ Auto-login + cookies set
→ Redirects to http://localhost:5173/#/sw/customer/detail/019a24bdea5d71158ac12e3f9ef465be/documents?edit=false
→ Exact page loaded with authentication
Pro tip: Bookmark your favorite admin URLs as localhost:8000/admin#/path and they'll automatically redirect to the
watcher!
Direct Watcher Access (After First Visit)
Once you've visited localhost:8000/admin once in your browser session, you can use watcher URLs directly:
http://localhost:5173/#/sw/customer/...works immediately- Cookies persist across both ports
- No need to go through localhost:8000 again until cookies expire
Standard Admin (No Watcher)
If the admin watcher is not running, the plugin works as a simple auto-login:
- Navigate to
http://localhost:8000/admin - Automatically logged in and redirected to dashboard
How It Works
Simple and clean pure PHP backend approach:
-
Intercepts
/adminRequests:- Listens for GET requests to
/adminpath - Issues OAuth tokens using
admin/shopwarecredentials - Sets
bearerAuthcookies forlocalhostdomain (works on all ports)
- Listens for GET requests to
-
Admin Watcher Detection:
- Reads
ADMIN_PORTenvironment variable (defaults to 5173) - Tests if admin watcher is running by checking port accessibility
- If detected, generates HTML redirect; otherwise, standard HTTP redirect
- Reads
-
Hash Preservation:
- Uses client-side JavaScript to read
window.location.hash - Redirects to watcher URL with hash intact
- Deep links work perfectly:
localhost:8000/admin#/sw/customer/...→localhost:5173/#/sw/customer/...
- Uses client-side JavaScript to read
-
Cookie Compatibility:
SameSite=LAXallows cookies across different ports- Once set, cookies persist for both
:8000and:5173 - No additional API calls or user action required
Safety Note
- This plugin is for development only. Do not use in production.
Uninstall
bin/console plugin:uninstall CKOUAdminAutoLogin
License
- MIT. See
LICENSEfile. - generated with AI assistance.