ExpressGateway / express-gateway

A microservices API Gateway built on top of Express.js
https://www.express-gateway.io
Apache License 2.0
2.97k stars 344 forks source link

How to get user detail in proxy api #933

Closed aroopghoshtarento closed 5 years ago

aroopghoshtarento commented 5 years ago

Hi,

I am using oauth2 policy and i need to get the logged in user detail in my proxy endpoint, but i am could not able to get that. I tried using forwardHeaders, but in that i get consumers but not the users.

XVincentX commented 5 years ago

@aroopghoshtarento Can you show how you're creating the user and how you're sending such header?

aroopghoshtarento commented 5 years ago

I created the user from eg users create then i created the app and credentials for oauth and basic-auth

aroopghoshtarento commented 5 years ago

policies:

Uncomment key-auth: when instructed to in the Getting Started guide.

  - oauth2:
     - action:
        passThrough: true
  - headers:
     - action:
          headersPrefix: 'eg-'
          forwardHeaders:
            id: 'consumer.id'
            consumer-name: 'consumer.name'
            consumer-type: 'consumer.type'
            requestID: 'requestID'
  - proxy:
      - action:
          serviceEndpoint: httpbin 
          changeOrigin: true
XVincentX commented 5 years ago

@aroopghoshtarento I'm assuming you're using the opaque token and not the JWT, is that correct?

XVincentX commented 5 years ago

By the way this is a duplicate of #888 — let's keep the conversation there.