Hi, I just managed to deploy my ktor-server-app to heroku. After a lot of struggle it finally worked š. One thing however is not working.
I hope somebody can help. I use jwt for authorization. I followed exactly this guide https://ktor.io/docs/jwt.html using RS256 (public/private) key pair.
Everything worked on localhost but on Heroku public key cannot be found. (More in Thread)
Tobias Gronbach
04/05/2022, 10:36 PM
On localhost this configuration worked just fine:
jwt {
privateKey = "PrivateKey"
issuer = "http://0.0.0.0:8080/"
audience = "http://0.0.0.0:8080/hello"
realm = "Access to 'hello'"
}
But on Heroku I get the following error:
com.auth0.jwk.SigningKeyNotFoundException: Failed to get key with kid 346899ed-9189-488f-9011-0ff4b6c08xyz
Caused by: java.util.concurrent.ExecutionException: com.auth0.jwk.NetworkException: Cannot obtain jwks from url https://myherokudomain/.well-known/jwks.json
What do I have to use for issuer? Anyone?
a
Aleksei Tirman [JB]
04/06/2022, 10:00 AM
You can use Herokuās config variables if you know your applicationās domain before deployment to reference them in a Ktor application config.