mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-26 01:06:00 +03:00
[GH-ISSUE #4232] [bug]: Self hosted with "https" After entering login credentials during authorization getting 401 unauthorisation error. #1527
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#1527
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 @analuramalho on GitHub (Aug 1, 2024).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/4232
Is there an existing issue for this?
Current behavior
When the user tries to log into the application with a Microsoft account, error 401 occurs, as an intermittent error.
There are no specific patterns for this error to occur, just sometimes the same user can connect normally and other times he cannot.
error : {"message":"Unauthorized","statusCode":401}
Steps to reproduce
and then -> 401 unauthorized error on UI (at this web url is https://sub-domain.com/v1/auth/microsoft/callback?code=0."some string"&state="some string"&session_state="some string"")
Here "some string" referring to alphanumeric value for security purpose have not given.
I found this similar issue but there is no solution to the problem here. We are already using version 2024.3.4
similar issue: https://github.com/hoppscotch/hoppscotch/issues/3194
Environment
Production
Version
Self-hosted
@bigghe commented on GitHub (Sep 12, 2024):
Ehi @analuramalho
Any news with this? Are you still facing the issue?
Another info, because I'm checking if hoppscotch could fit for me.
Does the selfhosted community edition allows for login through username/password?
@liyasthomas commented on GitHub (Sep 12, 2024):
Hi @analuramalho, we're looking into this ticket. Thanks for your patience.
@RockChinQ commented on GitHub (Dec 31, 2024):
Same issue here, I'm using hoppscotch-aio with Docker Compose, and using caddy to reverse proxy hopscotch.
this's the caddy config
env file
I was facing #3733 and finally solved that, when I try to login with GitHub, 401 error occurred.
@mirarifhasan commented on GitHub (Dec 31, 2024):
Hi @RockChinQ,
Could you please check the Docker container logs for any errors? If you find any, kindly share them with us. This will help us debug the issue more effectively.
@RockChinQ commented on GitHub (Jan 1, 2025):
this's the docker-compose.yaml file,
shared-networkis pre created.migration has already done in previous runs. And below is the whole logs from a new launch to the 401 occurred.
@RockChinQ commented on GitHub (Jan 1, 2025):
I deployed an
individual containersmode, which still met the 401 error.docker-compose.yaml
my own caddy file
the .env file
logs of the run I met 401 error
@VeevoTest commented on GitHub (Jan 3, 2025):
im facing same issue , i get 500 err then when it reload it gives 401
log :
Backend Server | Query Complexity: 7
Backend Server | Query Complexity: 4
Backend Server | Query Complexity: 3
Backend Server | Query Complexity: 3
Backend Server | Query Complexity: 17
Backend Server | [Nest] 37 - 01/03/2025, 7:21:16 AM ERROR [ExceptionsHandler] "expiresIn" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60
Backend Server | Error: "expiresIn" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60
Backend Server | at module.exports [as sign] (/dist/backend/node_modules/.pnpm/jsonwebtoken@9.0.2/node_modules/jsonwebtoken/sign.js:213:22)
Backend Server | at JwtService.sign (/dist/backend/node_modules/.pnpm/@nestjs+jwt@10.2.0_@nestjs+common@10.4.4_class-transformer@0.5.1_class-validator@0.14.1_refle_p73cogk5aumciauu2q42yaxpfq/node_modules/@nestjs/jwt/dist/jwt.service.js:41:20)
Backend Server | at AuthService.generateRefreshToken (/dist/backend/dist/auth/auth.service.js:76:52)
Backend Server | at AuthService.generateAuthTokens (/dist/backend/dist/auth/auth.service.js:94:41)
Backend Server | at AuthController.githubAuthRedirect (/dist/backend/dist/auth/auth.controller.js:74:51)
Backend Server | at /dist/backend/node_modules/.pnpm/@nestjs+core@10.4.4_@nestjs+common@10.4.4_class-transformer@0.5.1_class-validator@0.14.1_refl_uclmhdhodpinoxc7fwisrergn4/node_modules/@nestjs/core/router/router-execution-context.js:38:29
@VeevoTest commented on GitHub (Jan 3, 2025):
okay , my issue got resolved using changes suggested in issue#4205
by removing inline comments from .env got successful login .
@rintaaaa commented on GitHub (Jan 8, 2025):
@VeevoTest
How did you set up the login method?mail?GoogleOAuth?etc?
@VeevoTest commented on GitHub (Jan 8, 2025):
i used github for OAuth , problem was rising due to inline comment in example .env file.
following is my new env file:
#-----------------------Backend Config------------------------------#
Prisma Config
DATABASE_URL=postgresql://:@:5432/*****
(Optional) By default, the AIO container (when in subpath access mode) exposes the endpoint on port 80. Use this setting to specify a different port if needed.
#HOPP_AIO_ALTERNATE_PORT=80
Auth Tokens Config
JWT_SECRET=************
TOKEN_SALT_COMPLEXITY=10
MAGIC_LINK_TOKEN_VALIDITY=3
REFRESH_TOKEN_VALIDITY=604800000
ACCESS_TOKEN_VALIDITY=86400000
SESSION_SECRET=**secret-code-
Recommended to be true. Set to false if you are using http.
Note: Some auth providers may not support http requests and may stop working when set to false.
ALLOW_SECURE_COOKIES=false
Sensitive Data Encryption Key while storing in Database (32 character)
DATA_ENCRYPTION_KEY=8GMsSBBY9********************
Hoppscotch App Domain Config
REDIRECT_URL=http://:3000
WHITELISTED_ORIGINS=http://:3170,http://:3000,http://***:3100
VITE_ALLOWED_AUTH_PROVIDERS=GITHUB
Github Auth Config
GITHUB_CLIENT_ID=***********
GITHUB_CLIENT_SECRET=***********
GITHUB_CALLBACK_URL=http://***********:3170/v1/auth/github/callback
GITHUB_SCOPE=user:email
Rate Limit Config
RATE_LIMIT_TTL=60 # In seconds
RATE_LIMIT_MAX=100 # Max requests per IP
#-----------------------Frontend Config------------------------------#
Base URLs
VITE_BASE_URL=http://:3000
VITE_SHORTCODE_BASE_URL=http://:3000
VITE_ADMIN_URL=http://***********:3100
Backend URLs
VITE_BACKEND_GQL_URL=http://:3170/graphql
VITE_BACKEND_WS_URL=wss://:3170/graphql
VITE_BACKEND_API_URL=http://***********:3170/v1
Set to true for subpath based access
ENABLE_SUBPATH_BASED_ACCESS=false
@nvroot commented on GitHub (Apr 15, 2025):
Remove database storage and try again
sudo rm -rf pgsql-data