mean-expert-official / loopback-sdk-builder

Tool for auto-generating Software Development Kits (SDKs) for LoopBack
Other
399 stars 178 forks source link

Public Remote method with No authorization header #521

Closed thiagovito closed 3 years ago

thiagovito commented 6 years ago

What type of issue are you creating?

What version of this module are you using?

Write other if any:

Please add a description for your issue:

We have noticed that the SDK sends Authorization Header by default in every request when users are logged. Therefore, it adds an extra time on its execution.

So our point is: Is there a way to remove the authorization header to methods(endpoints) that do not require Authorization?

jonathan-casarrubias commented 6 years ago

@thiagovito You might want to use custom headers on your methods not needing the authorization header.

Every method is generated with an argument function to modify the headers

thiagovito commented 6 years ago

@jonathan-casarrubias Sorry if this is a stupid question. But I have tried implementing the custom headers. I could not find any documentation of how to use it.

Could you please show me an example of its implementation? I would appreciate it in advance, and apologies to take your time.

jonathan-casarrubias commented 6 years ago
this.myServiceApi.myRemoteMethod(MyParam1, MyParam2, (headers) => {
  // do something with headers (e.g. remove authentication)
  return headers; // Return modified headers
})