Skip to content

Commit e3fd33d

Browse files
committed
fixed github oauth
1 parent a8dbdf3 commit e3fd33d

File tree

3 files changed

+28
-4
lines changed

3 files changed

+28
-4
lines changed

.env

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
REDIS_URL=usw2-nice-coral-30322.upstash.io
2+
SSL_CERT = <sslcert>
3+
SSL_KEY = <sslkey>
4+
TOKEN_KEY=gamjatang
5+
USER_DB_PW=pscale_pw_KM7TIo5sE3KQATgGCEVoz7J8MbtErw4Loq9D2xbQu2b
6+
USER_DB_PW_MYSQL=codesmith
7+
USER_DB_URL=mysql://19uo3ra8fayg80dooxr7:pscale_pw_KM7TIo5sE3KQATgGCEVoz7J8MbtErw4Loq9D2xbQu2b@us-west.connect.psdb.cloud/dbspy_4?sslaccept=strict
8+
USER_DB_URL_MYSQL=rds-mysql-login.c4kx2mpfn6ld.us-west-2.rds.amazonaws.com
9+
USER_DB_USER=19uo3ra8fayg80dooxr7
10+
USER_DB_USER_MYSQL=dbspy
11+
GITHUB_OAUTH_CLIENT_SECRET=6ba7ab8bef953d09418540953f756a00e50424eb
12+
GITHUB_OAUTH_REDIRECT_URI= http://localhost:8080/display/
13+
GOOGLE_AUTH_CALLBACK= https://db-spy.io/api/oauth/google
14+
GOOGLE_AUTH_CLIENT_ID=1050970973422-4am2mv6e621f83lggfcjubkl3hqtoj0k.apps.googleusercontent.com
15+
GOOGLE_AUTH_CLIENT_SECRET=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
16+
GOOGLE_OAUTH_CLIENT_ID=507124943654-nd7fhcdfvmendo2ntsrpj0pifg7paa36.apps.googleusercontent.com
17+
GOOGLE_OAUTH_CLIENT_SECRET=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
18+
GOOGLE_OAUTH_REDIRECT_URI= http://localhost:8080/display/
19+
NODE_ENV=production
20+
REDIS_PASSWORD=60d5ca03e2054922b2d067308d1145a1
21+
REDIS_PORT=30322
22+
REDIS_SECRET=gamjaREDIS
23+
CLIENT_ENDPOINT=https://db-spy.io
24+
DATABASE_URL=mysql://85w3ikfzj2d89b1pq0fr:pscale_pw_C0W9vlthntKGiSmjXGH24YnVRhitoFd0gMKneBqFqCv@us-east.connect.psdb.cloud/dbspy?ssl={"rejectUnauthorized":true}
25+
GITHUB_OAUTH_CLIENT_ID=d44f1421ff7324a4468d

server/controllers/oauth.controller.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import log from '../logger/index';
44
dotenv.config();
55

66
export const getGoogleAccesToken: RequestHandler = (req: Request, res: Response, next: NextFunction) => {
7-
87
type code = string;
98
type state = string|null;
109
const {code,state} = req.body;
@@ -102,12 +101,12 @@ export const getUserInfo:RequestHandler = async (req:Request, res:Response, next
102101
if(data.status >= 200 && data.status < 300){
103102
userInfo = await data.json()
104103
userInfo = {...userInfo, type:'google'}
105-
res.locals.userInfo = userInfo;
106-
return next();
107104
}else{
108105
throw new Error('error exist in oauthcontroller.ts in getUserInfo middleware');
109106
}
110107
}
108+
res.locals.userInfo = userInfo;
109+
return next();
111110
}
112111
catch(err){
113112
next({

src/pages/Login.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ function getGoogle():void{
8080
const getGithub = ():void => {
8181
const rootUrl: string = 'https://github.com/login/oauth/authorize';
8282
const options: Options = {
83-
redirect_uri: 'https://db-spy.io/display',
83+
redirect_uri: 'http://localhost:8080/display/',
8484
client_id: 'd44f1421ff7324a4468d',
8585
state: 'randomstring',
8686
allow_signup: 'true',

0 commit comments

Comments
 (0)