koajs / koajs/userauth

[feat] fetch get json request return 403 not 302

Open
#40 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
139
Forks
17
PR merge metrics
No merged PRs in 30d

Description

## Describe the feature

When we use fetch to get json data from server,userauth return 302 with redirect url。Fetch will throw TypeError: failed to fetch caused by cors error. It's better to throw 403 with login expired message to make frontend do the re-login easily.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the userauth middleware's handling of fetch requests and the existing 302 redirect path; no file or test is named in the issue. Verify the behavior with a JSON request, and consider the work done when an expired login produces a 403 with a login-expired message instead of a redirect.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
authentication, backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.