https://www.ory.sh/ logo
#talk-hydra
Title
# talk-hydra
w

worried-rain-90392

04/11/2022, 11:24 AM
Greetings Hydra, I am trying to add custom claims to an access token JWT. I have added the ‘allowed_top_level_claims’ to the hydra.yaml for a new claim ‘user_id’ [https://www.ory.sh/docs/hydra/reference/configuration]. Now, how do I actually create a claim with ‘exec hydra token’ command? If I try to add it to the docker compose file, I get an error saying the new ‘user_id’ does not exist as an option. docker-compose -f quickstart.yml exec hydra \
hydra token user \
--client-id auth-code-client \
--audience api.infosum.com \
--user_id joe.bloggs \
--client-secret secret \
--endpoint http://127.0.0.1:4444/ \
--port 5555 \
--scope openid,offline
Error: unknown flag: --user_id
w

white-greece-76805

04/11/2022, 11:40 AM
the reason for this is:
An exemplary OAuth 2.0 Client performing the OAuth 2.0 Authorize Code Flow
, this is an example implementation of a token create in hydra, if you want to have a token with a subject, you need to request it yourself via the API https://www.ory.sh/docs/hydra/reference/api
f

faint-toddler-5440

04/11/2022, 4:12 PM
To add custom claims, you should add them when you accept the consent login request using hydra admin api
All claims by default are possible
t

thankful-secretary-66849

08/17/2022, 4:56 AM
I was trying to do this as well. How do we add the user's id to the user_id claim?
f

faint-toddler-5440

09/08/2022, 9:19 AM
just add an user claims using the proxy
(Add them to the user token)
5 Views