Greetings Hydra, I am trying to add custom claims ...
# talk-hydra
w
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
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
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
I was trying to do this as well. How do we add the user's id to the user_id claim?
f
just add an user claims using the proxy
(Add them to the user token)