arter/amos-social-auth

该软件包最新版本(1.3.3)没有可用的许可证信息。

社交认证

该软件包的官方仓库似乎已不存在,因此该软件包已被冻结。

安装: 585

依赖项: 1

建议者: 0

安全: 0

类型:组件

1.3.3 2022-05-04 16:00 UTC

This package is auto-updated.

Last update: 2024-06-16 20:07:54 UTC


README

Amos 社交认证

安装

  1. 安装此扩展的首选方式是通过 composer

    运行

     composer require arter/amos-social-auth
    

    或添加

     "arter/amos-social-auth": "~1.0"
    

    到您的 composer.json 文件的 require 部分。

  2. 将模块添加到您的 common 主配置文件中

    <?php
    'modules' => [
        'socialauth' => [
            'class' => 'arter\amos\socialauth\Module'
        ],
    ],
    
  3. 应用迁移

     php yii migrate/up --migrationPath=@vendor/arter/amos-social-auth/src/migrations
    

配置

  • 示例配置

      <?php
          'modules' => [
              'socialauth' => [
                  'class' => 'arter\amos\socialauth\Module',
                  'enableLogin' => true,
                  'enableLink' => false,
                  'enableRegister' => false,
                  'providers' => [
                     "Facebook" => [
                          "enabled" => true,
                          "keys" => [
                              "id" => "",
                              "secret" => ""
                          ],
                          "scope" => "email"
                      ],
                      "Twitter" => [
                          "enabled" => true,
                          "keys" => [
                              "key" => "",
                              "secret" => ""
                          ],
                          "scope" => 'email',
                          "includeEmail" => true
                      ],
                      "Google" => [
                          "enabled" => true,
                          "keys" => [
                              "id" => "",
                              "secret" => ""
                          ],
                          "scope" => 'email',
                          "includeEmail" => true
                      ],
                  ]
              ],
          ],
    

    查看配置文档:https://hybridauth.github.io/hybridauth/userguide/Configuration.html

  • 启用/禁用操作

    • enableLogin 允许社交登录
    • enableLink 启用社交账户链接(my-profile 'settings' 选项卡)
    • enableRegister 启用使用社交的注册
    • enableServices 列出与社交账户相关的已启用服务。默认情况下,数组包含 calendarcontacts

提供者链接功能在 'My Profile', amos-admin 中管理。要启用社交链接,请检查管理员配置中 social-accounts 框的可见性以及提供者按钮。

$modules['admin'] =  [
    'class' => 'arter\amos\admin\AmosAdmin',
	'enableRegister' => true,
         'fieldsConfigurations' => [
                'boxes' => [
                    .
                    .
                    .
                    'box_social_account' => ['form' => true, 'view' => true],
                ],
                'fields' => [
                    .
                    .
                    .   
                    'facebook' => ['form' => true, 'view' => true, 'referToBox' => 'box_social_account'],
                    'google' => ['form' => true, 'view' => true, 'referToBox' => 'box_social_account'],
                    'linkedin' => ['form' => true, 'view' => true, 'referToBox' => 'box_social_account'],
                    'twitter' => ['form' => true, 'view' => true, 'referToBox' => 'box_social_account'],
                    .
                    .
                    .
                ]
            ]
        ];

提供者

提供者配置文档:https://hybridauth.github.io/hybridauth/userguide.html 部分 '热门提供者'