0

I have a working autoregister gateway function, which fills my gateway-config.yml. We will be using scopes so I added scopes to postData, but it doesn't add scopes.

const postData = JSON.stringify({
      host: '*',
      path: currentKey,
      methods: methodsByPaths.get(currentKey),
      scopes:
        Scopes[`${process.env.ENDPOINT}${currentKey.split('/').join('')}`],
    });
  • Some console log of currentKey and the Scopes[...]

/api/users - undefined

/api/token - undefined

/api/createProject - PROJECT-MANAGER

Also, when the scope is undefined, it adds the endpoint, if it is not undefined (project-manager) it didn't even add the endpoint. I tried hard codding scopes to something and it still didn't work

Vanyo
  • 1
  • 1

1 Answers1

0

You shouldn’t send scopes in the POST request; they are strictly internal to Express Gateway.

When a user is authenticated by Express Gateway, the authentication credential defined in Express’s config.yml file the user is authenticated against should include the list of scopes the user has access to; these are used internally by Express Gateway to control access to endpoints.

James McLeod
  • 2,381
  • 1
  • 17
  • 19