You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Specifying an Authorization header for auth doesn't appear to be applied request. The following will return 401 Unauthorized and no Authorization header is shown in the XHR request
import{UsersApi,createConfiguration,AuthMethodsConfiguration,server1}from'@generated/ts-client';constconfig=createConfiguration({baseServer: server1,authMethods: {"bearer-key": "Bearer "+authToken}});// Using the following or passing config to individual requests will result in `401 Unauthorized`constusersApi=newUsersApi(config);
A generated client method to show that auth configuration is unused
publicasyncdeletePost(postId: string, options?: Configuration): Promise<RequestContext> {
letconfig = options || this.configuration;
// verify required parameter 'postId' is not null or undefinedif (postId === null || postId === undefined) {
thrownewRequiredError('Required parameter postId was null or undefined when calling deletePost.');
}
// Path ParamsconstlocalVarPath = '/posts/{postId}'
.replace('{' + 'postId' + '}', encodeURIComponent(String(postId)));
// Make Request ContextconstrequestContext = config.baseServer.makeRequestContext(localVarPath, HttpMethod.DELETE);
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
// Query Params// Header Params// Form Params// Body Params// Apply auth methodsreturnrequestContext;
}
neuroretransmit
changed the title
[BUG] Typescript client does not make use of configuration
[BUG] Typescript client does not make use of auth configuration
Mar 19, 2021
Bug Report Checklist
Description
Generated typescript client does not apply
Authorization
header.openapi-generator version
5.0.1
OpenAPI declaration file content or url
Generation Details
Gradle plugin
Steps to reproduce
Specifying an
Authorization
header for auth doesn't appear to be applied request. The following will return401 Unauthorized
and no Authorization header is shown in the XHR requestOAS I used to find this bug.
Usage in project
A generated client method to show that auth configuration is unused
Related issues/PRs
#4633
Suggest a fix
Still need to investigate, just a report for now.
The text was updated successfully, but these errors were encountered: