Repository navigation
Read granted permissions from the backend session in backend mode - #148
Merged
brionmario merged 1 commit intoOct 30, 2026
Merged
Conversation
In backend mode the access token stays on the backend, but useGrantedPermissions read the permissions by decoding the access token. In backend mode that meant asking the backend's token endpoint for one, which a BFF doesn't offer, so an app saw no permissions. The backend's session now carries the granted scopes (BackendSession scope, the token response's scope), and a new ThunderIDBrowserClient.getGrantedPermissions() reads them from the session the client already holds. In backend mode a session without scope grants nothing, and the client never asks for a token. In redirect mode the permissions are still read from the access token. The React and Vue useGrantedPermissions call getGrantedPermissions() through their contexts. Nuxt provides it from its existing token route, so it behaves as before, and Next.js marks it unsupported on its client context, since its hook reads permissions through a server action. Signed-off-by: Brion <info@brionmario.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
rajithacharith
approved these changes
Oct 30, 2026
This was referenced Oct 30, 2026
3 of 12 tasks
Merged
4 of 12 tasks
6 of 13 tasks
brionmario
added a commit
to brionmario/thunderid
that referenced
this pull request
Oct 30, 2026
Moves @thunderid/react to 1.11.2 and @thunderid/react-router to 1.10.2, which bring @thunderid/browser 1.9.2 and @thunderid/javascript 1.10.2. These include thunder-id/javascript-sdks#148: in backend mode, useGrantedPermissions reads the granted permissions from the backend's session (scope) instead of decoding an access token. A console signed in through a backend (BFF) then shows the pages its permissions allow, instead of "Nothing to manage". Signed-off-by: Brion <info@brionmario.com>
lashinijay
pushed a commit
to lashinijay/thunderid
that referenced
this pull request
Oct 30, 2026
Moves @thunderid/react to 1.11.1 and @thunderid/react-router to 1.10.1 (@thunderid/browser 1.9.1 and @thunderid/javascript 1.10.1 follow transitively). These releases post the SSO sessions a flow's responses return on the authorization callback (thunder-id/javascript-sdks#147), so a sign-in through the Gate that asks for the device_sso scope now receives a device secret (thunder-id#6227). They also bring Device Grant support (thunder-id/javascript-sdks#140), an ouId prop on GroupMembers (thunder-id/javascript-sdks#146), and granted permissions read from the backend session in backend mode (thunder-id/javascript-sdks#148). Refs thunder-id#6144 Signed-off-by: ImalshaD <plid475@gmail.com>
brionmario
added a commit
to brionmario/thunderid
that referenced
this pull request
Oct 30, 2026
Moves @thunderid/react to 1.11.2 and @thunderid/react-router to 1.10.2, which bring @thunderid/browser 1.9.2 and @thunderid/javascript 1.10.2. They include two backend-mode (endpoints.backend) changes: - thunder-id/javascript-sdks#148: useGrantedPermissions reads the granted permissions from the backend's session (scope) instead of decoding an access token. A console signed in through a backend (BFF) then shows the pages its permissions allow, instead of "Nothing to manage". - thunder-id/javascript-sdks#149: the top-level baseUrl is the backend, endpoint paths resolve against it, and the API behind the proxy is endpoints.backend.apiBaseUrl. Neither changes redirect mode, which the consoles use by default. Signed-off-by: Brion <info@brionmario.com>
brionmario
added a commit
to brionmario/thunderid
that referenced
this pull request
Oct 30, 2026
Moves @thunderid/react to 1.11.3 and @thunderid/react-router to 1.10.3, which bring @thunderid/browser 1.9.3 and @thunderid/javascript 1.10.3. They include three backend-mode (endpoints.backend) changes: - thunder-id/javascript-sdks#148: useGrantedPermissions reads the granted permissions from the backend's session (scope) instead of decoding an access token. A console signed in through a backend (BFF) then shows the pages its permissions allow, instead of "Nothing to manage". - thunder-id/javascript-sdks#149: the top-level baseUrl is the backend, and endpoint paths resolve against it. - thunder-id/javascript-sdks#150: the SDK's API calls go to the backend's proxy (baseUrl + proxy), so the frontend never needs the API's own address; the backend maps the proxy to it. None of them changes redirect mode, which the consoles use by default. Signed-off-by: Brion <info@brionmario.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
In backend mode (
endpoints.backend) the access token stays on the backend, butuseGrantedPermissionsreads the permissions by decoding the access token. In backend modegetAccessToken()asks the backend's token endpoint for one, which a BFF doesn't offer, since keeping tokens out of the browser is the point of the pattern (RFC 10017 §6.1). The app then sees no permissions: for example, a ThunderID admin console run behind a BFF shows "Nothing to manage".An OAuth client learns what it was granted from the token response's
scope(RFC 6749 §5.1), not by reading the access token. A backend has that, so it can report it with the session, and the app reads it from there.Approach
BackendSessiongains an optionalscope, the granted scopes as space-separated text, like the token response'sscope.ThunderIDBrowserClient.getGrantedPermissions()returns the granted permissions.scopegrants nothing.scopeorscopesclaim, asuseGrantedPermissionsdid before.getGrantedPermissions, anduseGrantedPermissionscalls it instead of decoding the token itself. The hooks' signatures and results don't change.getGrantedPermissionsfrom its existing token route, so Nuxt behaves as before.getGrantedPermissionsis marked unsupported on the client context, likegetAccessToken. Its ownuseGrantedPermissionsreads permissions through a server action and is unchanged.A backend that doesn't send
scopeyet makes its app see no permissions in backend mode, where before it saw them only if it also issued tokens throughendpoints.backend.token.Related Issues
Related PRs
scopeadded. That follows separately.useGrantedPermissions.SDK parity
The mobile SDKs have the same gap: each has
getGrantedPermissions()and a backend mode, and in backend mode each reads permissions by decoding a token from the backend's token endpoint. Ported with the same change (scopeon the backend session, read in backend mode, never a token request):Checklist
scopefor the product's token.ThunderIDBrowserClient.backend.test.ts,useGrantedPermissions.test.tsx,resource-query.test.ts)breaking changelabel added.parity/prs-raisedorparity/prs-not-neededadded.parity/prs-raised, the port links are posted as a reply on the parity check's comment.Security checks
In backend mode the browser never asks for an access token to read permissions. The permissions decide only what the app shows; the server still checks every request.