Skip to content

Commit

Permalink
feat: Allow custom accessKey on console api (#216)
Browse files Browse the repository at this point in the history
  • Loading branch information
Danwakeem committed Jul 12, 2023
1 parent 2c5e1a7 commit dca4bc4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions api-request.js
Expand Up @@ -20,9 +20,13 @@ module.exports = async (pathname, options = {}) => {
const authMethod = options.noAuth ? 'none' : await resolveAuthMethod();
if (!authMethod) throw new Error('Not authenticated to send request to the Console server');
const requestId = ++requestIdCounter;
const authorization = options.noAuth
? {}
: { Authorization: `Bearer ${await resolveAuthToken()}` };
let authorization = {};
if (!options.noAuth && !options.accessKey) {
authorization = { Authorization: `Bearer ${await resolveAuthToken()}` };
} else if (!options.noAuth && options.accessKey) {
authorization = { Authorization: `Bearer ${options.accessKey}` };
}

const response = await (async () => {
const url = `${urls[options.urlName] || urls.backend}${pathname}`;
const headers = {
Expand Down

0 comments on commit dca4bc4

Please sign in to comment.