Error while running oAuth middleware


I am following this link to start the oAuth middleware after setting the required values, but i am getting below error message while running the command. Any idea what exactly is the issue?

daml oauth2-middleware --config /oauth-middleware.conf

daml-helper: Received ExitFailure 1 when running
Raw command: java -Dlogback.configurationFile=/home/rocky/.daml/sdk/2.6.4/daml-sdk/oauth2-middleware-logback.xml -jar /home/rocky/.daml/sdk/2.6.4/daml-sdk/daml-sdk.jar oauth2-middleware --config /oauth-middleware.conf

What happens when you run this directly?

java -Dlogback.configurationFile=/home/rocky/.daml/sdk/2.6.4/daml-sdk/oauth2-middleware-logback.xml -jar /home/rocky/.daml/sdk/2.6.4/daml-sdk/daml-sdk.jar oauth2-middleware --config /oauth-middleware.conf

The path to your config file seems a bit weird - / is usually only writable by root. I suspect that path is wrong and that’s why the middleware is not starting.

It’s a bit unfortunate that it isn’t giving a more appropriate error message.

1 Like

I started the oauth2-middleware using cli-args as shown below

–http-port 3265

In console it shows

12:45:41.324 [main] WARN com.daml.auth.middleware.oauth2.Cli - Using cli opts for running oauth2-middleware is deprecated
12:45:41.611 [] INFO akka.event.slf4j.Slf4jLogger - Slf4jLogger started
12:45:42.292 [] INFO c.daml.auth.middleware.oauth2.Main$ - Started server: ServerBinding(/

My question is, how would i test endpoints in postman, I dont see any logs in the console when i hit below URL in postman-

Just an update i am able to hit the endpoint using the postman. But getting below response. Any inputs on this. How to resolve it?

Authentication is possible but has failed or not yet been provided.

Below is the endpoint i am trying

Hi @Rocky,

I’m unfortunately not very familiar with either Postman or the OAuth2 Middleware, so I’m not in a great position to help you. I’ll try to find someone who might be a better fit.

Hi @Rocky,

Just had a quick look over the Scala code to see if I can understand your observations within a code context.

In order for the /auth endpoint to provide an authorised response, we need:

  • a valid access token to be supplied
  • and for that token to provide the requested claims.

As you are observing a response that appears to be consistent with an unauthorised response, I currently feel this might be the issue being displayed here?

As I was digging around, I did note that there’s some helpful looking notes in the file daml/ at cfc499fbb69f916c54f2fcb5c8094291a3b8faf0 · digital-asset/daml · GitHub. Hopefully these might help you out further here?

Hope that helps,

Carl. and here are placeholders. If you haven’t done so, you need to populate all the URLs with real ones corresponding to your application (in place of and your token provider (in place of Eg use Auth0).