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

#187419056 Add Google authentication to enhance user login #20

Merged
merged 2 commits into from
Apr 29, 2024

Conversation

Hakizimana-Clement
Copy link
Collaborator

@Hakizimana-Clement Hakizimana-Clement commented Apr 24, 2024

What does this PR do?

This PR aims to enhance user login by adding Google authentication. By implementing this feature, users will be able to log in using their pre-existing Google accounts.

Description of Task to be completed?

The following endpoints need to be functional:

GET /api/v1/users/auth/google
GET /api/v1/users/auth/google/callback

How should this be manually tested?

To verify the changes introduced by this PR:

  1. Clone the repository and navigate to the project directory.

  2. Run npm install to install the necessary dependencies.

  3. Check the env-example file and create a .env file, filling in the environment variables as specified in the example.

  4. Start the application by running npm run dev.

  5. There are two ways to test the Google authentication:

    • Use the Swagger documentation by accessing the endpoint api/v1/docs.
    • Utilize the Google authentication endpoint directly: api/v1/users/auth/google.

What are the relevant pivotal tracker/Trello stories?

#187419056.

@@ -0,0 +1,66 @@
import app from "../app";
Copy link

Choose a reason for hiding this comment

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

Parsing error: 'import' and 'export' may appear only with 'sourceType: module'

@Hakizimana-Clement Hakizimana-Clement force-pushed the feat-login-google-187419056 branch from 487d631 to 2d76359 Compare April 26, 2024 07:21
@@ -0,0 +1,47 @@
import { GOOGLE_CALLBACK_URL, PORT } from "../utils/keys";
Copy link

Choose a reason for hiding this comment

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

Parsing error: 'import' and 'export' may appear only with 'sourceType: module'

import swaggerDoc from "./swagger.json";
import { PORT } from "../utils/keys";
import users from "./user";
import basicInfo from "./basicInfo";
Copy link

Choose a reason for hiding this comment

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

Parsing error: 'import' and 'export' may appear only with 'sourceType: module'

@Hakizimana-Clement Hakizimana-Clement force-pushed the feat-login-google-187419056 branch from 2d76359 to b20cb8d Compare April 26, 2024 07:27
import { google_profile } from "../mock/static";
jest.setTimeout(30000);

function logErrors(
Copy link

Choose a reason for hiding this comment

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

Identical blocks of code found in 2 locations. Consider refactoring.

- Integrate Google ID into the user model for OAuth.
- Set up Google authentication strategy with Passport.
- Establish '/auth/google' and '/auth/google/callback' routes.
- Develop controller logic for handling Google OAuth.

[Finishes #187419056]
- Added "migrate undo" and "migrate" commands to the test process.
[Finishes #187419056]
@Hakizimana-Clement Hakizimana-Clement force-pushed the feat-login-google-187419056 branch from a49a112 to 45dddc2 Compare April 29, 2024 21:43
const { body } = await Jest_request.get("/").expect(200);
});

it("should display login home page and return 200", async () => {
Copy link

Choose a reason for hiding this comment

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

Identical blocks of code found in 2 locations. Consider refactoring.

},
],
summary: "Request password reset",
requestBody: {
Copy link

Choose a reason for hiding this comment

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

Similar blocks of code found in 3 locations. Consider refactoring.

required: true,
description: "The reset password token",
},
],
Copy link

Choose a reason for hiding this comment

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

Similar blocks of code found in 3 locations. Consider refactoring.

name: "request body",
required: true,
},
],
Copy link

Choose a reason for hiding this comment

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

Similar blocks of code found in 3 locations. Consider refactoring.

Copy link

codeclimate bot commented Apr 29, 2024

Code Climate has analyzed commit 45dddc2 and detected 7 issues on this pull request.

Here's the issue category breakdown:

Category Count
Duplication 7

The test coverage on the diff in this pull request is 61.7% (60% is the threshold).

This pull request will bring the total coverage in the repository to 87.5% (-3.5% change).

View more on Code Climate.

@Hakizimana-Clement Hakizimana-Clement requested review from GarrixA and removed request for cyusasnave April 29, 2024 22:21
Copy link
Collaborator

@YvetteNyibuka YvetteNyibuka left a comment

Choose a reason for hiding this comment

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

Good Job Clement

@leandreAlly leandreAlly merged commit 3d45482 into develop Apr 29, 2024
4 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants