auth0 / node-auth0

Node.js client library for the Auth0 platform.
MIT License
630 stars 309 forks source link

[v4 Beta] passwordGrant docs + not possible to set auth0-forwarded-for #895

Closed BramRoets closed 1 year ago

BramRoets commented 1 year ago

Checklist

Description

The generated docs for passwordGrant are incorrect. Additionally, it's not possible to pass auth0-forwarded-for

Reproduction

  1. Install the latest beta
  2. Try the following piece of code
  3. Receive an error that headers is not accepted.
await auth0.oauth.passwordGrant({
    username: 'myusername@example.com',
    password: 'mypassword'
},
{ headers: { 'auth0-forwarded-for': 'END.USER.IP.123' } }
);

Additional context

No response

node-auth0 version

4.0.0-beta.6

Node.js version

v18.16.1

adamjmcgrath commented 1 year ago

Hi @BramRoets - thanks for raising this

You need to pass grantOptions.initOverrides like so:

await auth0.oauth.passwordGrant({
        username: 'myusername@example.com',
        password: 'mypassword'
    },
    { initOverrides: { headers: { 'auth0-forwarded-for': 'END.USER.IP.123' } } }
);

Will fix the docs

BramRoets commented 1 year ago

Hi @BramRoets - thanks for raising this

You need to pass grantOptions.initOverrides like so:

await auth0.oauth.passwordGrant({
       username: 'myusername@example.com',
       password: 'mypassword'
   },
   { initOverrides: { headers: { 'auth0-forwarded-for': 'END.USER.IP.123' } } }
);

Will fix the docs

Awesome. thanks!