auth
auth copied to clipboard
Implement LinkedIn via OpenID-Connect
Setup:
- Create an application in linkedIn https://developer.linkedin.com/
- Ensure the application is approved
- Go to your application dashboard, under "Products" tab and enable "Sign In with LinkedIn using OpenID Connect" https://i.imgur.com/xL7nnqT.png
- Configure your users.php with the following provider:
'OAuth' => [
'providers' => [
'linkedInOpenIDConnect' => [
'service' => \CakeDC\Auth\Social\Service\OpenIDConnectService::class,
'className' => \League\OAuth2\Client\Provider\LinkedIn::class,
'mapper' => \CakeDC\Auth\Social\Mapper\LinkedInOpenIDConnect::class,
'options' => [
'redirectUri' => Router::fullBaseUrl() . '/auth/linkedInOpenIDConnect',
'linkSocialUri' => Router::fullBaseUrl() . '/link-social/linkedInOpenIDConnect',
'callbackLinkSocialUri' => Router::fullBaseUrl() . '/callback-link-social/linkedInOpenIDConnect',
'defaultScopes' => ['email', 'openid', 'profile'],
// you can check your credentials in the "Auth" tab of your application dashboard in LinkedIn developers page
'clientId' => 'YOUR_CLIENT_ID',
'clientSecret' => 'YOUR_CLIENT_SECRET',
],
],
],
],
Note: when merged, we'll need to update the documentation in cakedc/users to reflect this new social provider. A migration guide from the old OAuth2 provider could be a good idea too...
Note2: unit tests being finished now
Codecov Report
Merging #81 (7d73629) into 7.next-cake4 (9e126f8) will decrease coverage by
1.45%. The diff coverage is47.61%.
:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.
@@ Coverage Diff @@
## 7.next-cake4 #81 +/- ##
==================================================
- Coverage 90.32% 88.87% -1.45%
- Complexity 318 330 +12
==================================================
Files 47 49 +2
Lines 775 944 +169
==================================================
+ Hits 700 839 +139
- Misses 75 105 +30
| Files | Coverage Δ | |
|---|---|---|
| src/Social/Mapper/LinkedInOpenIDConnect.php | 100.00% <100.00%> (ø) |
|
| src/Social/Service/OpenIDConnectService.php | 45.00% <45.00%> (ø) |
... and 19 files with indirect coverage changes
:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more