syncano-node icon indicating copy to clipboard operation
syncano-node copied to clipboard

endpoint.get and post don't forward user key

Open rafcamlet opened this issue 7 years ago • 4 comments

Without manual define x-user-key header, target endpoint don't set user.

    const result = await endpoint.get('example/endpoint', {
        someData: 'asdf'
      }
    }, {headers: {'x-user-key': ctx.meta.user.user_key}})

rafcamlet avatar Mar 28 '18 07:03 rafcamlet

This is not supported in core. We need add some method like in client library e.g. setToken or setUserToken.

mkucharz avatar Mar 28 '18 08:03 mkucharz

@mkucharz Maybe we should always forward user key if it's detected in current request, what do you think?

Idered avatar Mar 28 '18 11:03 Idered

@Idered No, I think in many cases we don’t want to pass it (especially for private endpoints). It should be more explicit. Maybe some flag?

mkucharz avatar Mar 28 '18 12:03 mkucharz

@mkucharz can you write at least one example? That sub request is still a part of main request which have user data.

Idered avatar Mar 28 '18 12:03 Idered