Skip to content

Commit f9b36bb

Browse files
committed
add github social login
1 parent 0051671 commit f9b36bb

19 files changed

Lines changed: 706 additions & 12 deletions

README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Next you need to apply migrations to create the database tables:
1313
```bash
1414
ddev exec bin/cake migrations migrate
1515
ddev exec bin/cake migrations migrate -p Tags
16+
ddev exec bin/cake migrations migrate -p ADmad/SocialAuth
1617
```
1718

1819
After that you can perform a fresh sync via
@@ -21,9 +22,27 @@ After that you can perform a fresh sync via
2122
ddev exec bin/cake sync_packages
2223
```
2324

25+
While that is running (takes quite a while) you should install node modules and start the dev server via
26+
27+
```bash
28+
ddev exec npm i
29+
ddev exec bin/cake devserver
30+
```
31+
2432
With that you should now see what is currently on the production site.
2533

26-
## Cleaning up tables
34+
## Get social auth working
35+
36+
If you want to test/develop social auth via Github you need to set the following 2 environment variables in your `config/.env` file:
37+
38+
```
39+
export AUTH_ID_GITHUB="someid"
40+
export AUTH_SECRET_GITHUB="somesecret"
41+
```
42+
43+
You can get these tokens via creating a Github OAuth App on https://github.com/settings/developers
44+
45+
## Cleaning up packages
2746

2847
If you want to clean up package data, you can run the following command:
2948

composer.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
"homepage": "https://cakephp.org",
77
"require": {
88
"php": ">=8.1",
9+
"admad/cakephp-social-auth": "^2.2",
10+
"cakephp/authentication": "^4.0",
911
"cakephp/cakephp": "5.3.*",
1012
"cakephp/migrations": "^5.0.0",
1113
"cakephp/plugin-installer": "^2.0",

composer.lock

Lines changed: 244 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
use Migrations\BaseMigration;
5+
6+
class Users extends BaseMigration
7+
{
8+
/**
9+
* Change Method.
10+
*
11+
* More information on this method is available here:
12+
* https://book.cakephp.org/migrations/5/en/migrations.html#the-change-method
13+
*
14+
* @return void
15+
*/
16+
public function change(): void
17+
{
18+
$this->table('users')
19+
->addColumn('first_name', 'string', ['null' => true])
20+
->addColumn('last_name', 'string', ['null' => true])
21+
->addColumn('email', 'string')
22+
->addColumn('username', 'string')
23+
->addColumn('is_cakephp_dev', 'boolean', ['default' => false])
24+
->addTimestamps('created', 'modified')
25+
->addIndex('email', ['unique' => true])
26+
->addIndex('username', ['unique' => true])
27+
->create();
28+
}
29+
}
4.56 KB
Binary file not shown.

config/app.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@
9292
// 'cacheTime' => '+1 year'
9393
],
9494

95+
'GitHub' => [
96+
'applicationId' => env('AUTH_ID_GITHUB'),
97+
'applicationSecret' => env('AUTH_SECRET_GITHUB'),
98+
],
99+
95100
'Packages' => [
96101
'featured' => [
97102
'markstory/asset_compress',
@@ -470,4 +475,8 @@
470475
'errorLevel' => null,
471476
'fixtureStrategy' => null,
472477
],
478+
479+
'Migrations' => [
480+
'add_timestamps_use_datetime' => true,
481+
],
473482
];

0 commit comments

Comments
 (0)