Skip to content

Commit f6f570b

Browse files
committed
Changed frontend to typescript and copied nivetha's code over. Fixed bugs in persistent login detection for user
1 parent bbb8076 commit f6f570b

36 files changed

+778
-2296
lines changed

backend/user-service/src/auth/auth.controller.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ export class AuthController {
88

99
@Post('/google/callback')
1010
async handleRedirect(@Req() req: Request, @Res() res: Response) {
11-
console.log("HELLLO")
1211
const {token} = req.body
1312
const tokens = await this.authService.verifyJWTToken(token)
1413
res.json(tokens);

backend/user-service/src/auth/auth.service.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,16 @@ export class AuthService {
1414
this.clientSecret = configService.get<string>('GOOGLE_CLIENT_SECRET');
1515
this.oAuth2Client = new OAuth2Client(this.clientID, this.clientSecret, 'http://localhost:3000');
1616
}
17-
1817
async verifyJWTToken(jwtToken: string) {
1918
const loginTicket = await this.oAuth2Client.verifyIdToken({
2019
idToken: jwtToken,
2120
audience: this.clientID
2221
})
2322
const payload = loginTicket.getPayload();
24-
console.log("PAYLOAD")
25-
console.log(payload);
23+
2624
const tokenData = { sub: payload['sub'], email: payload['email'], name: payload['name'], picture: payload['picture'] }
2725
const accessToken = await this.jwtService.signAsync(tokenData, { expiresIn: "2h" });
28-
console.log("THIS IS THE TOKEN ", accessToken);
26+
// console.log("THIS IS THE TOKEN ", accessToken);
2927
return {jwtToken: accessToken};
3028
}
3129

frontend/.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
PORT=3000
2+
REACT_APP_GOOGLE_CLIENT_ID=350585476549-mild3b1ggbtd57t4sduk8qlc7d8suq66.apps.googleusercontent.com

frontend/README.md

Lines changed: 7 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ In the project directory, you can run:
99
### `npm start`
1010

1111
Runs the app in the development mode.\
12-
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
12+
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
1313

14-
The page will reload when you make changes.\
15-
You may also see any lint errors in the console.
14+
The page will reload if you make edits.\
15+
You will also see any lint errors in the console.
1616

1717
### `npm test`
1818

@@ -31,40 +31,16 @@ See the section about [deployment](https://facebook.github.io/create-react-app/d
3131

3232
### `npm run eject`
3333

34-
**Note: this is a one-way operation. Once you `eject`, you can't go back!**
34+
**Note: this is a one-way operation. Once you `eject`, you cant go back!**
3535

36-
If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
36+
If you arent satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
3737

38-
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
38+
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point youre on your own.
3939

40-
You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
40+
You dont have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldnt feel obligated to use this feature. However we understand that this tool wouldnt be useful if you couldnt customize it when you are ready for it.
4141

4242
## Learn More
4343

4444
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
4545

4646
To learn React, check out the [React documentation](https://reactjs.org/).
47-
48-
### Code Splitting
49-
50-
This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
51-
52-
### Analyzing the Bundle Size
53-
54-
This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
55-
56-
### Making a Progressive Web App
57-
58-
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
59-
60-
### Advanced Configuration
61-
62-
This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
63-
64-
### Deployment
65-
66-
This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
67-
68-
### `npm run build` fails to minify
69-
70-
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)

0 commit comments

Comments
 (0)