mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-25 16:55:59 +03:00
[GH-ISSUE #5107] [bug]: GitHub login fails with unique constraint failed for provider and providerAccountId #1942
Labels
No labels
CodeDay
a11y
browser limited
bug
bug fix
cli
core
critical
design
desktop
discussion
docker
documentation
duplicate
enterprise
feature
feature
fosshack
future
good first issue
hacktoberfest
help wanted
i18n
invalid
major
minor
need information
need testing
not applicable to hoppscotch
not reproducible
pull-request
question
refactor
resolved
sandbox
self-host
spam
stale
testmu
wip
wont fix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hoppscotch#1942
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @nitobuendia on GitHub (May 29, 2025).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/5107
Is there an existing issue for this?
Current behavior
I have Hoppscotch self-hosted on a custom domain. It has been working well in the past.
Today, when I tried to login using GitHub, it failed. (See steps to reproduce).
The URL redirected to:
https://<backend>/v1/auth/github/callback?code=<code>&state=<state>which simply remplied wtih the following JSON:
I think I had this issue before and was able to fix it - but (1) I don't remember how, and (2) it feels too recurrent now.
Steps to reproduce
Logs and Screenshots
Looking at the logs, we can get some more detail:
Looking at the Postgres database, and the Account table, there are 3 users:
provider=magicand have different providerAccountId (i.e. different emails)provider=githuband the id is therefore unique.I feel it might be trying to create a new account instead of using the existing one. I am not sure if this might be related to the client id / secret or something else. I am not sure how to troubleshoot since the error is throwing me a bit off.
Environment
Production
Hoppscotch Version
Self-hosted
Interceptor
Not Applicable - Issue not related to network requests
Browsers Affected
Chrome, Not browser-specific
Operating System
MacOS
Additional Information
@mirarifhasan commented on GitHub (May 30, 2025):
Hi @nitobuendia,
To resolve the error, you could delete the entry from the
accounttable whereprovider = 'github'.However, let's hold off on that for now and try to identify the root cause first. Could you please try the following:
We've only been able to reproduce this issue when the email was manually updated in the user table via SQL or similar methods. If you haven’t done that, please try logging in again using GitHub SSO with the same email that’s linked (via the foreign key relationship) to the existing
provider = 'github'account.Let me know how it goes or if you notice any new entries in the
accounttable.@mirarifhasan commented on GitHub (Jul 21, 2025):
Closing this issue as the solution has been provided. Feel free to reopen if you're still experiencing problems after trying the suggested fix.
@nitobuendia commented on GitHub (Aug 5, 2025):
Hi @mirarifhasan - I missed this. The application started working again without any changes from my side. Hence, I didn't need to follow these steps, but thank you for sharing and I will try this if it happens again.
FWIW, I had made changes to the table once to update the
providerAccessToken, due to a different error back then. Nothing else was changed and it worked ever since. However, it would align to what you're mentioning somehow.Thank you!