Skip to content

feat(js): add new User.sessions scope#1080

Open
simeng-li wants to merge 1 commit intomasterfrom
simeng-update-user-scope
Open

feat(js): add new User.sessions scope#1080
simeng-li wants to merge 1 commit intomasterfrom
simeng-update-user-scope

Conversation

@simeng-li
Copy link
Copy Markdown
Contributor

Summary

Add new User.sessions scope

Testing

Checklist

  • .changeset
  • unit tests
  • integration tests
  • necessary TSDoc comments

add new User.sessions scope
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new JS SDK user scope (urn:logto:scope:sessions) intended for session-management authorization (Account API), without introducing any new ID token or userinfo claims.

Changes:

  • Add UserScope.Sessions to the UserScope enum.
  • Ensure the new scope maps to no claims in idTokenClaims / userinfoClaims.
  • Add a changeset entry for releasing the new scope.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
packages/js/src/consts/openid.ts Introduces UserScope.Sessions and wires it into the scope→claims maps as an empty-claims scope.
.changeset/cold-mayflies-crash.md Adds release note for the new sessions scope.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

* Scope for user's sessions.
*
* Only used for session management via account API.
* Not included in user claims, even when the scope is requested, as it's not meant for ID token or userinfo endpoint.
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The JSDoc says "Not included in user claims" but this scope is still part of the userClaims mapping (with an empty array). Consider rewording to clarify that requesting this scope does not add any ID token / userinfo claims (rather than implying it is absent from the mapping entirely).

Suggested change
* Not included in user claims, even when the scope is requested, as it's not meant for ID token or userinfo endpoint.
* Requesting this scope does not add any ID token or userinfo claims; it is not intended for ID Token or Userinfo responses.

Copilot uses AI. Check for mistakes.
"@logto/js": patch
---

indroduce new user scope urn:logto:scope:sessions
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in changeset entry: "indroduce" should be "introduce".

Suggested change
indroduce new user scope urn:logto:scope:sessions
introduce new user scope urn:logto:scope:sessions

Copilot uses AI. Check for mistakes.

indroduce new user scope urn:logto:scope:sessions

This new `User.sessions` scope is used for session management account API permission control. It does not include any claims in ID token or userinfo endpoint, as it's not meant for user information retrieval but rather for controlling access to session management features.
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changeset text references User.sessions, but the JS API exposed by this PR is UserScope.Sessions (and there doesn't appear to be a User.sessions symbol in the package). Please update the changeset wording to match the actual exported API name to avoid confusing consumers.

Suggested change
This new `User.sessions` scope is used for session management account API permission control. It does not include any claims in ID token or userinfo endpoint, as it's not meant for user information retrieval but rather for controlling access to session management features.
This new `UserScope.Sessions` scope is used for session management account API permission control. It does not include any claims in ID token or userinfo endpoint, as it's not meant for user information retrieval but rather for controlling access to session management features.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants