Skip to content

How to add additional claims to the token? #53

Open
@BenjamenMeyer

Description

@BenjamenMeyer

Services often need to add their own claims to tokens to manage what users are allowed to do in a system. OIDC providers like Okta, Auth0, and others allow their users to add claims via configuration and integrations to support this. How can this be done with mockoidc? One can decode the access token to get the claims.

I tried building a custom user object:

type myUserObject struct {
    mockoidc.MockUser
    PhoneVerified bool
}

with the Claims() method adding the additional data to the jwt.Claims, but I still only get the original data - nothing in the way of the custom claims I added.

What am I missing?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions