定制 componentk/shopware6-admin-auto-login 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

componentk/shopware6-admin-auto-login

Composer 安装命令:

composer require componentk/shopware6-admin-auto-login

包简介

Designed for developer environment Shopware 6 only. Just auto logs in using the default admin user/pass

README 文档

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 credentials admin / shopware.
  • Writes a bearerAuth cookie (root path and admin path) and redirects to the Administration dashboard.
  • If a valid bearerAuth cookie already exists, it does nothing.
  • Provides an API endpoint /api/_action/ckou-auto-login for manual authentication (useful with admin watcher).

Requirements

  • Shopware >= 6.7.0.
  • An admin user with username admin and password shopware in your dev environment.
  • APP_URL environment variable set to your base URL (defaults to http://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:

  1. Intercepts /admin Requests:

    • Listens for GET requests to /admin path
    • Issues OAuth tokens using admin / shopware credentials
    • Sets bearerAuth cookies for localhost domain (works on all ports)
  2. Admin Watcher Detection:

    • Reads ADMIN_PORT environment variable (defaults to 5173)
    • Tests if admin watcher is running by checking port accessibility
    • If detected, generates HTML redirect; otherwise, standard HTTP redirect
  3. 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/...
  4. Cookie Compatibility:

    • SameSite=LAX allows cookies across different ports
    • Once set, cookies persist for both :8000 and :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 LICENSE file.
  • generated with AI assistance.

componentk/shopware6-admin-auto-login 适用场景与选型建议

componentk/shopware6-admin-auto-login 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 10 月 30 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 componentk/shopware6-admin-auto-login 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 componentk/shopware6-admin-auto-login 我们能提供哪些服务?
定制开发 / 二次开发

基于 componentk/shopware6-admin-auto-login 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 12
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-10-30