Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,22 @@ impl {{{classname}}} for {{{classname}}}Client {
{{/isKeyInHeader}}
{{/isApiKey}}
{{#isBasic}}
{{^isBasicBearer}}
if let Some(ref auth_conf) = configuration.basic_auth {
req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
};
{{/isBasicBearer}}
{{/isBasic}}
{{#isOAuth}}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
{{/isOAuth}}
{{#isBasicBearer}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@boxdot thanks for the PR. I would suggest put this new block inside the {{#isBasic}} ... {{/isBasic}} block. What do you think?

And what about creating bearer_access_token instead or reusing oauth_access_token?

Some other clients are using access_token so it can be shared with OAuth, Bearer authentications.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I'm working with @boxdot)

I think having a single access_token also works, but I guess by adding bearer_access_token (see last commit in PR), we avoid breaking existing clients.

if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
{{/isBasicBearer}}
{{/authMethods}}
{{/hasAuthMethods}}
{{#isMultipart}}
Expand Down