Skip to content

Commit f7a3f35

Browse files
committed
refactor: move TalentPulse OAuth provider configuraiton to .env
1 parent 35b4b88 commit f7a3f35

File tree

2 files changed

+16
-20
lines changed

2 files changed

+16
-20
lines changed

.env.example

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
11
NEXT_TELEMETRY_DEBUG=0
22

3-
NEXT_PUBLIC_BACKEND_URL=https://api.talentpulse.localhost
3+
BACKEND_API_URL=http://backend-application-nginx-1:80
4+
5+
NEXTAUTH_URL=https://talentpulse.localhost
6+
NEXTAUTH_URL_INTERNAL=backend-application-php-1
7+
NEXTAUTH_SECRET=sthfj9JGE3FEhVxniT0i7pSphnoJXkbJviR/A7j3afc=
8+
9+
BACKEND_OAUTH_CLIENT_ID=f6812d1a-6a73-4d62-a708-25fdf76161f5
10+
BACKEND_OAUTH_CLIENT_SECRET=qpYyQLBChY5JWrq9uMNBp5s5BrJdyBhcNG79vkdh
11+
BACKEND_OAUTH_AUTHORIZATION_URL=https://talentpulse-backend.localhost/auth/methods/oauth/authorize
12+
BACKEND_OAUTH_TOKEN_URL=http://backend-application-nginx-1:80/auth/methods/oauth/token
13+
BACKEND_OAUTH_USER_INFO_URL=http://backend-application-nginx-1:80/auth/current-user

src/lib/auth.ts

+5-19
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,17 @@ export const TalentPulseOAuth = (options: OAuthUserConfig<Record<string, any>>):
99
version: '2.0',
1010
idToken: false,
1111
authorization: {
12-
url: "http://localhost:3004/auth/methods/oauth/authorize",
13-
// url: "https://api.talentpulse.localhost/auth/methods/oauth/authorize",
12+
url: process.env.BACKEND_OAUTH_AUTHORIZATION_URL,
1413
params: {
1514
scope: null
1615
},
1716
},
18-
// token: "https://api.talentpulse.localhost/auth/methods/oauth/token",
19-
token: "http://localhost:3004/auth/methods/oauth/token",
20-
// userinfo: "https://api.talentpulse.localhost/auth/current-user",
21-
userinfo: "https://localhost:3004/auth/current-user",
22-
// token: {
23-
// url: "https://api.talentpulse.localhost/auth/methods/oauth/token",
24-
// async request(context) {
25-
// console.log('#####')
26-
// console.log(context)
27-
// console.log('#####')
28-
// // const tokens = await fetch(contex)
29-
// return { }
30-
// }
31-
// },
17+
token: process.env.BACKEND_OAUTH_TOKEN_URL,
18+
userinfo: process.env.BACKEND_OAUTH_USER_INFO_URL,
3219
profile(profile) {
3320
return {
34-
id: profile.data.id,
35-
first_name: profile.data.first_name,
36-
last_name: profile.data.last_name,
21+
id: profile.data.uuid,
22+
name: profile.data.first_name + ' ' + profile.data.last_name,
3723
email: profile.data.email,
3824
}
3925
},

0 commit comments

Comments
 (0)