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

Feature/discord oauth p2 - functionality #194

Merged
merged 9 commits into from
Sep 3, 2024
Merged

Conversation

cherylli
Copy link
Contributor

@cherylli cherylli commented Aug 31, 2024

Description

Add discord login functionality, go to http://localhost:8000/api/v1/auth/discord/login, a discord login / authorize screen will pop up, click authorize and it will grant access token, refresh token and then redirect to the frontend url

It gets the user discord email,

  • if this email exists in our database, we add a discord oauth profile to that user
  • if the email does not exist, we create a new user + an oauth profile

Currently, if the user has different emails for credentials, and differnet oauth, it will create different accounts as we have no way to match users with different emails. In future, we should make it so user can link their social accounts to their existing email, this way, we can link their accounts without needing to match their emails

Issue link

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature updates / changes
  • Tests
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Login, and check access_token, refresh_token in cookies
Make sure to db seed before testing, discord needs to be in the oauthProvider table otherwise it will generate an error

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have updated the change log

@cherylli cherylli self-assigned this Aug 31, 2024
timDeHof
timDeHof previously approved these changes Sep 1, 2024
Copy link
Contributor

@timDeHof timDeHof left a comment

Choose a reason for hiding this comment

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

All unit and e2e test pass and 0authProvider in the database shows discord in the model

@cherylli
Copy link
Contributor Author

cherylli commented Sep 1, 2024

@timDeHof need a re-review if you can please, resolved changelog conflict

Copy link
Contributor

@Ajen07 Ajen07 left a comment

Choose a reason for hiding this comment

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

The Discord login flow is working well, and new user is being added to the database correctly.

Copy link
Contributor

@timDeHof timDeHof left a comment

Choose a reason for hiding this comment

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

Every unit & e2e tests passed. Also able to login into the dashboard using discord

@cherylli cherylli merged commit f81b90a into dev Sep 3, 2024
1 check passed
@cherylli cherylli deleted the feature/discord-oauth-p2 branch September 3, 2024 02:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants