Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature request: Augment IdTokenClaims in LogToClient configuration in order to include custom data #5406

Open
MatteoGauthier opened this issue Feb 13, 2024 · 6 comments
Assignees
Labels

Comments

@MatteoGauthier
Copy link

What problem did you meet?

I'd like to be able to extend the JWT IdTokenClaims data to include data such as identifiers, etc...

Describe what you'd like Logto to have

With the server side SDK, I think it would be interesting to be able to add properties to the JWT when instantiating the LogToClient class (with @logto/next for example).

  const logtoClient = new LogtoClient({
    appId: env.LOGTO_CLIENT_ID,
    appSecret: env.LOGTO_CLIENT_SECRET,
    endpoint: env.LOGTO_ENDPOINT,
    baseUrl,
    // @todo change
    cookieSecret: env.NEXTAUTH_SECRET,
    cookieSecure: process.env.NODE_ENV === "production",
    scopes: ["openid", "profile", "email"],
	// Will be added to the IdTokenClaims and accesible through .getIdTokenClaims()
	customTokenData: {
		purchasedCourses: ['id1', 'id2]
	}
  })

Voilà ! have a nice day

@wangsijie
Copy link
Contributor

The team is working on the feature of customize JWT, @darcyYe could you please add some updates when the feature is ready?

@wangsijie wangsijie added the feature Cool stuff label Feb 19, 2024
@darcyYe
Copy link
Contributor

darcyYe commented Feb 19, 2024

Hi @MatteoGauthier , we are working on custom JWT these days. Unfortunately, we will only support access token customization in the release.
You can check whether a custom access token can meet your requirements once the feature is released. From your description, it seems that user-level data (purchased courses, in this case) should not be configured globally. Additionally, based on our perspective, this data is intended for API authorization, making it more suitable to be included in the access token.

Copy link

github-actions bot commented Mar 5, 2024

This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the stale label Mar 5, 2024
@xiaoyijun xiaoyijun removed the stale label Mar 6, 2024
Copy link

This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the stale label Mar 21, 2024
@darcyYe darcyYe removed the stale label Mar 28, 2024
@darcyYe
Copy link
Contributor

darcyYe commented Mar 28, 2024

Custom JWT feature will be available to Logto Cloud in following weeks, will post update here.

Copy link

This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the stale label Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

4 participants