Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use token when available #176

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
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
2 changes: 1 addition & 1 deletion lib/openshift-rest-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ async function openshiftClient (settings = {}) {
const user = config.auth.username || config.auth.user;
const password = config.auth.password || config.auth.pass;

const accessToken = await getTokenFromBasicAuth({ insecureSkipTlsVerify, url, user, password, authUrl });
const accessToken = config.auth.token ? config.auth.token : await getTokenFromBasicAuth({ insecureSkipTlsVerify, url, user, password, authUrl });
Copy link
Member

Choose a reason for hiding this comment

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

the only way to get to here is if you are also passing in a 'user' or 'username' in the config.auth, so if your config object looked like this:

{
  auth: {
    token: 'asawefwfwf'
  }
}

then this code would't get run. probably need to add a check a few lines up that a token is being passed

const clusterUrl = authUrl || url;
// Create clusterName from clusterUrl by removing 'https://'
const clusterName = clusterUrl.replace(/(^\w+:|^)\/\//, '');
Expand Down