open20/amos-social-auth
Composer 安装命令:
composer require open20/amos-social-auth
包简介
Social Auth
README 文档
README
Social Auth For Amos
Installation
-
The preferred way to install this extension is through composer.
Either run
composer require open20/amos-social-auth
or add
"open20/amos-social-auth": "~1.0"to the require section of your
composer.jsonfile. -
Add module to your main config in common:
<?php 'modules' => [ 'socialauth' => [ 'class' => 'open20\amos\socialauth\Module' ], ],
-
Apply migrations
php yii migrate/up --migrationPath=@vendor/open20/amos-social-auth/src/migrations
Configuration
-
Sample configuration
<?php 'modules' => [ 'socialauth' => [ 'class' => 'open20\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 ], ] ], ],
see configuration doc: https://hybridauth.github.io/hybridauth/userguide/Configuration.html
-
Action enable/disable
enableLoginTo alow Social LoginenableLinkTo Enable Social Account Linking (my-profile 'settings' tab)enableRegisterTo Enable Registration with SocialenableServicesTo list enabled services related to social accounts. By default the array containscalendarandcontacts
The provider linking functionality is managed in 'My Profile', amos-admin. To enable social links check in admin configuraion the visibility for box social-accounts and for the the providers buttons.
$modules['admin'] = [ 'class' => 'open20\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'], . . . ] ] ];
Providers
Providers configuration doc: https://hybridauth.github.io/hybridauth/userguide.html section 'Popular Providers'
- Google
(guide from https://hybridauth.github.io/hybridauth/userguide/IDProvider_info_Google.html)-
Go to the Google Developers Console https://console.developers.google.com/projectselector/apis/library?supportedpurview=project.
-
From the project drop-down, select a project, or create a new one.
-
Enable the Google API services: In the list of Google APIs, search for the Google+ API service. Select Google+ API from the results list. Press the Enable API button. The same for People API and Calendar API
- Enable API in Google console
for account and contacts: People API, Google+ API
for calendar events: Google Calendar API
- Enable API in Google console
-
When the process completes, enabled APIs appears in the list of enabled APIs. To access, select API Manager on the left sidebar menu, then select the Enabled APIs tab.
-
In the sidebar under "API Manager", select Credentials. In the Credentials tab, select the New credentials drop-down list, and choose OAuth client ID.
-
From the Application type list, choose the Web application.
-
Enter a name and provide this URLs as Authorized redirect URIs: https://YourPlatformUrl/socialauth/social-auth/sign-in?action=done&provider=google
https://YourPlatformUrl/socialauth/social-auth/sign-up?action=done&provider=google
https://YourPlatformUrl/admin/user-profile/enable-google-service -
Once you have registered, copy and past the created application credentials (Client ID and Secret) into the HybridAuth config file.
-
统计信息
- 总下载量: 270
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2020-06-01