Check session status: documentation and code are not consistent in this repo.
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tài liệu
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- javascript
- Lĩnh vực
- api, documentation
Hướng nghiên cứu
Bắt đầu với trang tài liệu session-check được liên kết và src/pkg/middleware.ts trong repository kratos-selfservice-ui-node được tham chiếu. So sánh các đầu vào toSession được tài liệu mô tả với lệnh gọi của middleware chỉ sử dụng cookie, sau đó làm rõ mục đích và cách sử dụng xSessionToken, đồng thời đảm bảo ví dụ khớp với hành vi thực tế của API.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Preflight checklist
- I could not find a solution in the existing issues, docs, nor discussions.
- I agree to follow this project's Code of Conduct.
- I have read and am following this repository's Contribution Guidelines.
- I have joined the Ory Community Slack.
- I am signed up to the Ory Security Patch Newsletter.
Ory Network Project
No response
Describe the bug
in the documentation, we need xSessionToken and cookie: https://www.ory.sh/docs/identities/sign-in/check-session-token-cookie-api :
const authHeader = req.headers.authorization
const hasAuthHeader = authHeader.startsWith("Bearer ")
const sessionToken = hasAuthHeader
? authHeader.slice(7, authHeader.length)
: null
const session = await ory
.toSession({
cookie: req.cookies.join("; "),
xSessionToken: sessionToken,
})
.catch((err) => {
// Check the error to see if it's a 401 / 403 -> not logged in
})
But in the code, we just need cookies:
https://github.com/ory/kratos-selfservice-ui-node/blob/master/src/pkg/middleware.ts#L72
frontend
.toSession({ cookie: req.header("cookie") })
.then(addSessionToRequest(req))
I can't find any explanation about what xSessionToken is used for.
Reproducing the bug
Relevant log output
No response
Relevant configuration
No response
Version
@ory/client": "^1.4.2",
On which operating system are you observing this issue?
Linux
In which environment are you deploying?
Docker
Additional Context
No response
- Ngôn ngữ chính
- TypeScript
- Star
- 161
- Fork
- 1.9k
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của ory/docs
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
good first issue help wanted upstream
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 72/100
-
bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
-
good first issue help wanted upstream
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Shared kratos pages can only belong to one sidebar — OEL readers lose navigation contextCó thể làm lại được @hperl đã nhận 80 ngày trước và không có pull request nào đang mở. Đang mở
Issue tương tự
-
area/frontend good first issue kind/cooldown
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
voidzero-dev/oxc-angular-compiler#511 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
langchain-ai/deepagentsjs#898 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
anomalyco/models.dev#8509 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug documentation P2 UI/UX
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày