helpful-traffic-4919
06/01/2023, 11:47 AMtoken, err := jwt.NewBuilder().
Claim("sub", "some_user").
Issuer(issuer).
Audience([]string{"https://[custom-domain]/oauth2/token"}).
IssuedAt(time.Now()).
JwtID(uuid.NewString()).
Expiration(time.Now().Add(1 * time.Hour)).
Build()
Fails with error:
The JWT in 'assertion' request parameter MUST contain an 'aud' (audience) claim containing a value 'https://[custom-domain]/oauth2/token' that identifies the authorization server as an intended audience.
Yet:
token, err := jwt.NewBuilder().
Claim("sub", "some_user").
Issuer(issuer).
Audience([]string{"https://[Ory-project-domain]/oauth2/token"}).
IssuedAt(time.Now()).
JwtID(uuid.NewString()).
Expiration(time.Now().Add(1 * time.Hour)).
Build()
Works just fine.
The custom domain is used throughout in the rest of my client code, including to access the /oauth2/token
endpoint, i.e.
req, err := http.NewRequest(http.MethodPost, "https://[custom-domain]/oauth2/token", strings.NewReader(data.Encode()))
Any pro tips on how to have Hydra accept the custom domain as a valid audience here?high-optician-2097
high-optician-2097
helpful-traffic-4919
06/01/2023, 11:53 AMconst issuer = "https://[custom-domain]"
high-optician-2097
high-optician-2097
helpful-traffic-4919
06/01/2023, 12:00 PMhttps://[custom-domain]
https://[custom-domain]/oauth2/token
Configured against the OAuth2 client, but alas that didn’t do ithigh-optician-2097
helpful-traffic-4919
06/01/2023, 1:56 PMhigh-optician-2097
high-optician-2097
helpful-traffic-4919
06/05/2023, 10:08 AM