kalypso63/social_auth 问题修复 & 功能扩展

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

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

kalypso63/social_auth

最新稳定版本:1.2.6

Composer 安装命令:

composer require kalypso63/social_auth

包简介

Authentication via social auth (Facebook, Twitter, Google +, LinkedIn & Instagram)

README 文档

README

Donate

Social Auth service for TYPO3 with Hybrid Auth API (Facebook, Twitter, Google + & LinkedIn)

Installation instructions

  • Install the extension using the Extension Manager
  • Register new app on Facebook, Twitter, Google, LinkedIn or Instagram and follow the instructions. Some examples are detailed on Hybrid auth user guide [http://hybridauth.sourceforge.net/userguide.html]
  • Configure via Extension Manager and add key + appId for each social provider & set options for fe_users creation (users pid and default usergroup id are required !)
  • Storage User Pid should be different from classic fe_users PID to prevent unique username
  • New for 8.7 instance, set file storage uid and path for fe_users.image (FAL is used now for image field)
  • Add excluded fields on update after each login. By default all fields (name,first_name,last_name,telephone,address,city,zip,country) are overwritten.
  • Add the static TS (typoscript) to your typoscript template

Frontend plugin integration

Two ways exist to integrate social auth on FE

  • Add Social auth plugin on your page. It create a link for each enabled providers
  • Create links on your fluid template like this (add namespace viewhelper at first):

{namespace socialauth=MV\SocialAuth\ViewHelpers}

<f:link.page pageType="1316773681" additionalParams="{tx_socialauth_pi1:{provider:'facebook',redirect:'{socialauth:currentUri()}'}}" noCacheHash="TRUE">Facebook</f:link.page>

You can change redirect URL with a custom page (like profil page) using {f:uri.page()} viewhelper instead of {socialauth:currentUri()}

Bootstrap Social CSS

Bootstrap social css is used by default on every views. You can disable it via Constant editor

Integration with Felogin

If felogin is used, you can add marker ###SOCIAL_AUTH### to your custom felogin template. Typoscript for Felogin is loaded on main TS

To custom render of generated links. Modify Typoscript like this :

plugin.tx_felogin_pi1{
    socialauth.wrap = <ul>|</ul>
    socialauth_provider{
        facebook = TEXT
        facebook{
            typolink{
                #Custom class or title
                #ATagParams =
            }
            wrap = <li>|</li>
            stdWrap.dataWrap = {LLL:EXT:social_auth/Resources/Private/Language/locallang.xlf:facebook.label}
        }
        twitter < .facebook
        twitter{
            stdWrap.dataWrap = {LLL:EXT:social_auth/Resources/Private/Language/locallang.xlf:twitter.label}
        }
        google < .facebook
        google{
            stdWrap.dataWrap = {LLL:EXT:social_auth/Resources/Private/Language/locallang.xlf:google.label}
        }
    }
}

Signal Slots for developer

3 slots are available to extend service authentification

  • beforeCreateOrUpdateUser
  • getUser
  • authUser

###Example of slot integration (This example add birthdate and extbase_type to general fields with beforeCreateOrUpdateUser signal)

YOUR_EXTENSION/ext_localconf.php

if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('social_auth')) {
    $signalSlotDispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\SignalSlot\\Dispatcher');
    $signalSlotDispatcher->connect(
        'MV\\SocialAuth\\Service\\SocialAuthenticationService',
        'beforeCreateOrUpdateUser',
        'Vendor\\ExtensionKey\\Slots\\UserAuthentificationSlot',
        'beforeCreateOrUpdateUser'
    );
}

YOUR_EXTENSION/Classes/Slots/UserAuthentificationSlot.php

<?php
namespace Vendor\ExtensionKey\Slots;
class UserAuthentificationSlot {
    /**
     * @param $hybridUser string
     * @param $fields array
     * @param \MV\SocialAuth\Service\SocialAuthenticationService $pObj
     */
    public function beforeCreateOrUpdateUser($hybridUser, &$fields = array(), \MV\SocialAuth\Service\SocialAuthenticationService $pObj) {
        $fields['tx_extbase_type'] = 'Tx_YourExtension_User';
        if($hybridUser->birthDay && $hybridUser->birthMonth && $hybridUser->birthYear){
            $fields['birthdate'] = mktime(NULL, NULL, NULL, (int) $hybridUser->birthMonth, (int) $hybridUser->birthDay, (int) $hybridUser->birthYear);
        }
    }
}

Troubles after upgrade with 1.1.0 version

If we have an error like "Could not scan for classes", just uninstall extension and clear cache before upgrade it.

Google + configuration

Don't forget to activate Google+ API on [Google developer console] and fill the field Authorized redirect uri with http://yourdomain/?type=1316773682&hauth.done=Google

Facebook strict mode

If you use Strict mode on your Facbook app, fill the field Valid Oauth redirect URIS with http://yourdomain/?type=1316773682&hauth_done=Facebook

##Facebook scope

By default social_auth use email scope but you can add more scopes detailled here : https://developers.facebook.com/docs/facebook-login/permissions/

统计信息

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

GitHub 信息

  • Stars: 7
  • Watchers: 2
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0
  • 更新时间: 2015-11-23