How to create ID token and how to add custom fields in ID token

Hi Team,

Can some one explain how to create ID token and refresh token.
We are planning to leverage ory hydra for authentication server.
I went through documentation but did not get complete picture.
Able to set up ory hydra with docker & postgress.
able to create client & able to create access token .
What is consent app.How it helps.
We need expose rest apis to provide refresh & id tokens with custom fileds …Please help

You can provide session value in consent accept request:

I am adding some pseudo code:

hydraReq := HydraConsentBody{
	GrantScope: []string{"offline"},
	Session: map[string]interface{}{
		"id_token": map[string]string{
			"demo": "demo",
		},
	},
}
reqData, err := json.Marshal(hydraReq)
reqBody := bytes.NewBuffer(reqData)
req, err := http.NewRequest(http.MethodPut, conf.Ory.HydraAdminURL+"/oauth2/auth/requests/consent/"+challenge+"/accept", reqBody)