1

How do I reference consumerId in order to log in express-gateway - are the eg- specific 'elements' documented anywhere?

mytest:
 apiEndpoints:
  - test
 policies:
  - log:
     action:
       message: ${req.consumerId} ${req.ip} ${req.method} ${req.originalUrl}
  - key-auth:
  - proxy:
     action:
      serviceEndpoint: testscore
      changeOrigin: true
      stripPath: true

gets me a Null response

2 Answers2

0

They are all put in the egContext bag object.

req.egContext.consumerId

Vincenzo
  • 1,549
  • 1
  • 9
  • 17
0

I could get the consumer id using: ${egContext.consumer.id} Note that it is available only after authorization policy like: oauth2

herbertsg
  • 20
  • 1