Redocly / Redocly/redoc

Basic Authentication in React - 401 Unauthorized

Open
#1,420 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
25.9k
Forks
2.4k
Avg merge
13h 10m
Merged PRs (30d)
4

Description

I'm using Redoc as a React component and I've just added basic authentication.

When I access the url of the spec directly it shows the login modal, but when I add the url to the React component and access the React website, the login modal doesn't appear and I get a 401 Unauthorized from the spec url.

Is there a way to show the login modal in the React website in the same way it appears accessing the spec url directly?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the difference between opening the spec URL directly and loading it through the React component. Trace how the React entry point handles a 401 response and compare it with the direct-spec authentication flow; done means the React website can show the login modal for protected specs.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, react, typescript
Domain
authentication, documentation, frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.