Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: google authentication backend #819

Merged
merged 4 commits into from
Jun 9, 2023
Merged

feat: google authentication backend #819

merged 4 commits into from
Jun 9, 2023

Conversation

Santosh7017
Copy link
Contributor

@Santosh7017 Santosh7017 commented Jun 6, 2023

Related Issue

ISSUE NUMBER #711

Changes made πŸ‘·πŸ»β€β™‚οΈ

This feature introduces the backend implementation of enhanced authentication functionality by integrating Google Account authentication. With this update, users will be able to securely authenticate and access the application using their Google Account credentials, providing an additional layer of authentication and simplifying the login process. This feature enhances the security and user experience of the application, ensuring reliable and convenient access for all users. The changes made in this pull request effectively enhance the overall authentication system, thereby strengthening the security and usability of the application.

Necessary steps to setup .env

these are the values of n .env file
CLIENT_ID = "" // OAuth client ID
CLIENT_SECRET = "" // OAuth client secret
CALLBACK_URL = "" // callback URL like (http://localhost:5000/auth/google/callback) in place of localhost put the live server's link where you will receive callback
successURL = "" // this URL will redirect user to the page where we want send him after succesfull authentication for example Home page URL(https://milaan.vercel.app/)

To create a Google OAuth client ID and client secret, you need to follow the steps below:

  • Go to the Google Cloud Console: Visit the Google Cloud Console at https://console.cloud.google.com/ and sign in with your Google account.

  • Create a new project: If you don't have a project yet, create a new project by clicking on the project drop-down menu at the top of the page and selecting "New Project". Give your project a name and click "Create".

  • Enable the necessary APIs: In the Cloud Console, go to the "APIs & Services" section. Click on "Library" in the left-hand menu. Search for and enable the following APIs:

  • Google OAuth 2.0 API

  • Set up OAuth consent screen: In the Cloud Console, navigate to the "APIs & Services" section and click on "OAuth consent screen" in the left-hand menu. Choose an appropriate user type and fill in the required information, such as the application name and authorized domains.

  • Create OAuth client ID: In the Cloud Console, go to the "APIs & Services" section and click on "Credentials" in the left-hand menu. Click on the "Create Credentials" button and select "OAuth client ID" from the drop-down menu.

  • Configure the OAuth client ID: Choose the application type, such as "Web application" or "Android/iOS app". Enter the necessary details, including authorized JavaScript origins or redirect URIs, depending on your application type. Save the configuration.

  • Obtain the client ID and client secret: Once you've created the OAuth client ID, the client ID and client secret will be displayed on the "Credentials" page. Make sure to copy and securely store these values as they are required for authenticating your application

to know more you can visit - https://support.google.com/cloud/answer/6158849?hl=en

@github-actions github-actions bot added πŸ’‘ feature This generally contains addition/changes to features. status: todo ⏳ This issue is yet to be seen by the maintainer of the project. labels Jun 6, 2023
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, @Santosh7017, thank you for opening a pull request.

Soon the maintainers/owner will review it and provide you with feedback/suggestions.
If you think it's something urgent, feel free to reach out to Tamal on Twitter.


Give us a ⭐ to show some support
Happy OpenSource πŸš€

@github-actions github-actions bot added the deployed This PR has been deployed to Vercel for testing. label Jun 6, 2023
@tamalCodes tamalCodes added the πŸ“ˆ Major This a breaking change as it changes different files, and dependencies. label Jun 6, 2023
Copy link
Member

@tamalCodes tamalCodes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look fine to me, can you perhaps record a short screencast (tools like Loom, OBS can be of help) and just show that the backend is working as intended ?

server/index.js Outdated
app.get("/", (req, res) => {
res.send("HELLO FROM HOME");
});

//* user routes
app.use("/user", require("./routes/User"));
app.use("/user", require("./routes/user"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert this back to ./routes/User as we have the file name as User.js having small letter can sometimes give rise to bugs.

server/package.json Show resolved Hide resolved
@tamalCodes tamalCodes added area/logic This issue is related to a logic fix. 🟨 priority: medium status: need changes 🚧 Changes have been requested for these PRs gssoc23 This issue/PR is part of GSSOC'23. level3 GSSOC 23 -> LEVEL 3 and removed status: todo ⏳ This issue is yet to be seen by the maintainer of the project. labels Jun 7, 2023
@github-actions
Copy link

github-actions bot commented Jun 7, 2023

This pull request has been deployed to Vercel.

Latest commit: f485ba4
βœ… Preview: https://milan-ujf6z5pf5-iamtamal.vercel.app
πŸ” Inspect: https://vercel.com/iamtamal/milan/FhnwTPM4DQ8wa2wosTovRWofJhwY

View Workflow Logs

@Santosh7017
Copy link
Contributor Author

The changes look fine to me, can you perhaps record a short screencast (tools like Loom, OBS can be of help) and just show that the backend is working as intended ?

Login process and API calling

google.authentication.mp4

Database Screenshot
image

Copy link
Member

@tamalCodes tamalCodes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing work,
This looks good to me, will be merged soon πŸŽ‰.

@tamalCodes tamalCodes added status: ready βœ… This PR has passed all the checks and is now ready to be merged. and removed status: need changes 🚧 Changes have been requested for these PRs labels Jun 9, 2023
@tamalCodes tamalCodes merged commit 9224629 into ngoworldcommunity:main Jun 9, 2023
4 checks passed
@Santosh7017
Copy link
Contributor Author

It is pleasing to receive this information. what next to do, Should I proceed with closing the current issue and opening a new one for the frontend?

@tamalCodes
Copy link
Member

It is pleasing to receive this information. what next to do, Should I proceed with closing the current issue and opening a new one for the frontend?

Yaa sure go ahead !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/logic This issue is related to a logic fix. deployed This PR has been deployed to Vercel for testing. πŸ’‘ feature This generally contains addition/changes to features. gssoc23 This issue/PR is part of GSSOC'23. level3 GSSOC 23 -> LEVEL 3 πŸ“ˆ Major This a breaking change as it changes different files, and dependencies. status: ready βœ… This PR has passed all the checks and is now ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants