Skip to content

Commit 88f9a10

Browse files
authored
Merge pull request #192 from authorizerdev/feat/apple-login
feat: add apple login
2 parents 3337dbd + 4e08d4f commit 88f9a10

File tree

19 files changed

+1918
-1557
lines changed

19 files changed

+1918
-1557
lines changed

app/package-lock.json

Lines changed: 1510 additions & 1510 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/package.json

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
{
2-
"name": "app",
3-
"version": "1.0.0",
4-
"description": "",
5-
"main": "index.js",
6-
"scripts": {
7-
"build": "rm -rf build && NODE_ENV=production node ./esbuild.config.js",
8-
"start": "NODE_ENV=development node ./esbuild.config.js"
9-
},
10-
"keywords": [],
11-
"author": "Lakhan Samani",
12-
"license": "ISC",
13-
"dependencies": {
14-
"@authorizerdev/authorizer-react": "^0.23.0",
15-
"@types/react": "^17.0.15",
16-
"@types/react-dom": "^17.0.9",
17-
"esbuild": "^0.12.17",
18-
"react": "^17.0.2",
19-
"react-dom": "^17.0.2",
20-
"react-is": "^17.0.2",
21-
"react-router-dom": "^5.2.0",
22-
"typescript": "^4.3.5",
23-
"styled-components": "^5.3.0"
24-
},
25-
"devDependencies": {
26-
"@types/react-router-dom": "^5.1.8",
27-
"@types/styled-components": "^5.1.11"
28-
}
2+
"name": "app",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"build": "rm -rf build && NODE_ENV=production node ./esbuild.config.js",
8+
"start": "NODE_ENV=development node ./esbuild.config.js"
9+
},
10+
"keywords": [],
11+
"author": "Lakhan Samani",
12+
"license": "ISC",
13+
"dependencies": {
14+
"@authorizerdev/authorizer-react": "^0.24.0",
15+
"@types/react": "^17.0.15",
16+
"@types/react-dom": "^17.0.9",
17+
"esbuild": "^0.12.17",
18+
"react": "^17.0.2",
19+
"react-dom": "^17.0.2",
20+
"react-is": "^17.0.2",
21+
"react-router-dom": "^5.2.0",
22+
"typescript": "^4.3.5",
23+
"styled-components": "^5.3.0"
24+
},
25+
"devDependencies": {
26+
"@types/react-router-dom": "^5.1.8",
27+
"@types/styled-components": "^5.1.11"
28+
}
2929
}

dashboard/src/components/EnvComponents/OAuthConfig.tsx

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,13 @@ import {
99
Divider,
1010
useMediaQuery,
1111
} from '@chakra-ui/react';
12-
import { FaGoogle, FaGithub, FaFacebookF, FaLinkedin } from 'react-icons/fa';
12+
import {
13+
FaGoogle,
14+
FaGithub,
15+
FaFacebookF,
16+
FaLinkedin,
17+
FaApple,
18+
} from 'react-icons/fa';
1319
import { TextInputType, HiddenInputType } from '../../constants';
1420

1521
const OAuthConfig = ({
@@ -216,7 +222,45 @@ const OAuthConfig = ({
216222
fieldVisibility={fieldVisibility}
217223
setFieldVisibility={setFieldVisibility}
218224
inputType={HiddenInputType.LINKEDIN_CLIENT_SECRET}
219-
placeholder="LinkedIn Secret"
225+
placeholder="LinkedIn Client Secret"
226+
/>
227+
</Center>
228+
</Flex>
229+
<Flex direction={isNotSmallerScreen ? 'row' : 'column'}>
230+
<Center
231+
w={isNotSmallerScreen ? '55px' : '35px'}
232+
h="35px"
233+
marginRight="1.5%"
234+
border="1px solid #3b5998"
235+
borderRadius="5px"
236+
>
237+
<FaApple style={{ color: '#3b5998' }} />
238+
</Center>
239+
<Center
240+
w={isNotSmallerScreen ? '70%' : '100%'}
241+
mt={isNotSmallerScreen ? '0' : '3'}
242+
marginRight="1.5%"
243+
>
244+
<InputField
245+
borderRadius={5}
246+
variables={envVariables}
247+
setVariables={setVariables}
248+
inputType={TextInputType.APPLE_CLIENT_ID}
249+
placeholder="Apple Client ID"
250+
/>
251+
</Center>
252+
<Center
253+
w={isNotSmallerScreen ? '70%' : '100%'}
254+
mt={isNotSmallerScreen ? '0' : '3'}
255+
>
256+
<InputField
257+
borderRadius={5}
258+
variables={envVariables}
259+
setVariables={setVariables}
260+
fieldVisibility={fieldVisibility}
261+
setFieldVisibility={setFieldVisibility}
262+
inputType={HiddenInputType.APPLE_CLIENT_SECRET}
263+
placeholder="Apple CLient Secret"
220264
/>
221265
</Center>
222266
</Flex>

dashboard/src/constants.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export const TextInputType = {
88
GITHUB_CLIENT_ID: 'GITHUB_CLIENT_ID',
99
FACEBOOK_CLIENT_ID: 'FACEBOOK_CLIENT_ID',
1010
LINKEDIN_CLIENT_ID: 'LINKEDIN_CLIENT_ID',
11+
APPLE_CLIENT_ID: 'APPLE_CLIENT_ID',
1112
JWT_ROLE_CLAIM: 'JWT_ROLE_CLAIM',
1213
REDIS_URL: 'REDIS_URL',
1314
SMTP_HOST: 'SMTP_HOST',
@@ -33,6 +34,7 @@ export const HiddenInputType = {
3334
GITHUB_CLIENT_SECRET: 'GITHUB_CLIENT_SECRET',
3435
FACEBOOK_CLIENT_SECRET: 'FACEBOOK_CLIENT_SECRET',
3536
LINKEDIN_CLIENT_SECRET: 'LINKEDIN_CLIENT_SECRET',
37+
APPLE_CLIENT_SECRET: 'APPLE_CLIENT_SECRET',
3638
JWT_SECRET: 'JWT_SECRET',
3739
SMTP_PASSWORD: 'SMTP_PASSWORD',
3840
ADMIN_SECRET: 'ADMIN_SECRET',
@@ -103,6 +105,8 @@ export interface envVarTypes {
103105
FACEBOOK_CLIENT_SECRET: string;
104106
LINKEDIN_CLIENT_ID: string;
105107
LINKEDIN_CLIENT_SECRET: string;
108+
APPLE_CLIENT_ID: string;
109+
APPLE_CLIENT_SECRET: string;
106110
ROLES: [string] | [];
107111
DEFAULT_ROLES: [string] | [];
108112
PROTECTED_ROLES: [string] | [];

dashboard/src/graphql/queries/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ export const EnvVariablesQuery = `
2828
FACEBOOK_CLIENT_SECRET,
2929
LINKEDIN_CLIENT_ID,
3030
LINKEDIN_CLIENT_SECRET,
31+
APPLE_CLIENT_ID,
32+
APPLE_CLIENT_SECRET,
3133
DEFAULT_ROLES,
3234
PROTECTED_ROLES,
3335
ROLES,

dashboard/src/pages/Environment.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ const Environment = () => {
4848
FACEBOOK_CLIENT_SECRET: '',
4949
LINKEDIN_CLIENT_ID: '',
5050
LINKEDIN_CLIENT_SECRET: '',
51+
APPLE_CLIENT_ID: '',
52+
APPLE_CLIENT_SECRET: '',
5153
ROLES: [],
5254
DEFAULT_ROLES: [],
5355
PROTECTED_ROLES: [],
@@ -86,6 +88,7 @@ const Environment = () => {
8688
GITHUB_CLIENT_SECRET: false,
8789
FACEBOOK_CLIENT_SECRET: false,
8890
LINKEDIN_CLIENT_SECRET: false,
91+
APPLE_CLIENT_SECRET: false,
8992
JWT_SECRET: false,
9093
SMTP_PASSWORD: false,
9194
ADMIN_SECRET: false,

package-lock.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/constants/env.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ const (
7979
EnvKeyLinkedInClientID = "LINKEDIN_CLIENT_ID"
8080
// EnvKeyLinkedinClientSecret key for env variable LINKEDIN_CLIENT_SECRET
8181
EnvKeyLinkedInClientSecret = "LINKEDIN_CLIENT_SECRET"
82+
// EnvKeyAppleClientID key for env variable APPLE_CLIENT_ID
83+
EnvKeyAppleClientID = "APPLE_CLIENT_ID"
84+
// EnvKeyAppleClientSecret key for env variable APPLE_CLIENT_SECRET
85+
EnvKeyAppleClientSecret = "APPLE_CLIENT_SECRET"
8286
// EnvKeyOrganizationName key for env variable ORGANIZATION_NAME
8387
EnvKeyOrganizationName = "ORGANIZATION_NAME"
8488
// EnvKeyOrganizationLogo key for env variable ORGANIZATION_LOGO

server/constants/signup_methods.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,6 @@ const (
1313
SignupMethodFacebook = "facebook"
1414
// SignupMethodLinkedin is the linkedin signup method
1515
SignupMethodLinkedIn = "linkedin"
16+
// SignupMethodApple is the apple signup method
17+
SignupMethodApple = "apple"
1618
)

server/env/env.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ func InitAllEnv() error {
7070
osFacebookClientSecret := os.Getenv(constants.EnvKeyFacebookClientSecret)
7171
osLinkedInClientID := os.Getenv(constants.EnvKeyLinkedInClientID)
7272
osLinkedInClientSecret := os.Getenv(constants.EnvKeyLinkedInClientSecret)
73+
osAppleClientID := os.Getenv(constants.EnvKeyAppleClientID)
74+
osAppleClientSecret := os.Getenv(constants.EnvKeyAppleClientSecret)
7375
osResetPasswordURL := os.Getenv(constants.EnvKeyResetPasswordURL)
7476
osOrganizationName := os.Getenv(constants.EnvKeyOrganizationName)
7577
osOrganizationLogo := os.Getenv(constants.EnvKeyOrganizationLogo)
@@ -361,6 +363,20 @@ func InitAllEnv() error {
361363
envData[constants.EnvKeyLinkedInClientSecret] = osLinkedInClientSecret
362364
}
363365

366+
if val, ok := envData[constants.EnvKeyAppleClientID]; !ok || val == "" {
367+
envData[constants.EnvKeyAppleClientID] = osAppleClientID
368+
}
369+
if osFacebookClientID != "" && envData[constants.EnvKeyAppleClientID] != osFacebookClientID {
370+
envData[constants.EnvKeyAppleClientID] = osAppleClientID
371+
}
372+
373+
if val, ok := envData[constants.EnvKeyAppleClientSecret]; !ok || val == "" {
374+
envData[constants.EnvKeyAppleClientSecret] = osAppleClientSecret
375+
}
376+
if osFacebookClientSecret != "" && envData[constants.EnvKeyAppleClientSecret] != osFacebookClientSecret {
377+
envData[constants.EnvKeyAppleClientSecret] = osAppleClientSecret
378+
}
379+
364380
if val, ok := envData[constants.EnvKeyResetPasswordURL]; !ok || val == "" {
365381
envData[constants.EnvKeyResetPasswordURL] = strings.TrimPrefix(osResetPasswordURL, "/")
366382
}

0 commit comments

Comments
 (0)