webspero/proton-auth-context 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

webspero/proton-auth-context

Composer 安装命令:

composer require webspero/proton-auth-context

包简介

proton auth service for laravel

README 文档

README

This is a Laravel package that provides authentication context functionality using Proton. It allows you to easily integrate Proton login functionality into your Laravel application.

Installation

  1. Run the following command to install the package:

    composer require home-bloks/proton-auth-context:dev-main
  2. Run the Proton authentication command:

    php artisan proton:auth
  3. Install the required npm packages:

    npm install
  4. Compile the assets:

    npm run dev

Configuration for VITE

  1. Update your vite.config.js file by adding the following code:

    import { defineConfig } from 'vite';
    import laravel from 'laravel-vite-plugin';
    import react from "@vitejs/plugin-react";
    
    export default defineConfig({
        plugins: [
            laravel({
                input: ['resources/css/app.css', 'resources/js/app.js'],
                refresh: true,
            }),
            react(),
        ],
    });
  2. Update your root JavaScript (entry point for react) file (e.g., App.jsx, app.jsx, Main.jsx) with the following code:

    import ReactDOM from "react-dom/client";
    import ProtonLoginButton from "./components/ProtonLoginButton";
    import { AuthContextProvider } from "./store/auth.context.jsx";
    
    ReactDOM.createRoot(document.getElementById("root")).render(
      <>
        <AuthContextProvider>
          <ProtonLoginButton />
        </AuthContextProvider>
      </>
    );
  3. Add the following code to your root template header before closing the </head> tag (welcome.blade.php by default):

    @viteReactRefresh
    @vite(['resources/js/app.jsx'])

    Note: Make sure the @vite('resources/js/app.jsx') file matches the root JavaScript file you updated.

  4. Place the following code where you want to add the ProtonLoginButton component:

    <div id="root"></div>

    You can change the id attribute according to your setup in the root JavaScript file.

  5. update your .env with following varibales:

   VITE_MAINNET_ACCOUNT=account_name
   VITE_MAINNET_CHAIN_NETWORK_ENDPOINTS=https://protontestnet.greymass.com
   VITE_MAINNET_CHAIN_ID=71ee83bcf52142d61019d95f9cc5427ba6a0d7ff8accd9e2088ae2abeaf3d3dd

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-06-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固