delboy1978uk / bone-social-auth
SocialAuth package for Bone Framework
v1.1.3
2022-11-03 22:57 UTC
Requires
- delboy1978uk/bone: ^3.9
- delboy1978uk/bone-user: ^2.0
- hybridauth/hybridauth: ^3.6
Requires (Dev)
- codeception/codeception: ^4.1
- codeception/module-asserts: ^1.0.0
- codeception/module-phpbrowser: ^1.0.0
- roave/security-advisories: dev-latest
README
SocialAuth package for Bone Framework using HybridAuth
installation
Use Composer
composer require delboy1978uk/bone-social-auth
Simply add to the config/packages.php
after the Bone User Package
<?php // use statements here use Bone\SocialAuth\SocialAuthPackage; return [ 'packages' => [ // packages here..., SocialAuthPackage::class, ], // ... ];
settings
Create a settings file in the config/
folder called bone-social-auth.php
:
return [ 'bone-social-auth' => [ 'callback' => 'https://awesome.scot/user/login/via', 'providers' => [ 'Twitter' => [ 'enabled' => false, 'keys' => [ 'id' => '...', 'secret' => '...', ] ], 'Google' => [ 'enabled' => true, 'keys' => [ 'id' => '...', 'secret' => '...', ] ], 'Github' => [ 'enabled' => true, 'keys' => [ 'id' => '...', 'secret' => '...', ] ], 'Facebook' => [ 'enabled' => true, 'keys' => [ 'key' => '...', 'secret' => '...', ] ], ] ], ];
usage
You will probably want to have the social links on your /user/login
link, so copy the View files from
vendor/delboy1978uk/bone-user/View/BoneUser
to the main App view src/View/BoneUser
and add the followimg
config to config/views.php
in order to override them:
return [ 'views' => [ 'boneuser' => 'src/App/View/BoneUser', ], ];
In any view file, and if overriding bone-user
then particularly src/App/View/BoneUser/login.php
, you can call
<?= $this->socialAuth() ?>
which will display some links to log you in. Once logged in you will have a standard bone-user.