Repository URL to install this package:
|
Version:
0.0.0-eb7f46753a3bdc ▾
|
const fetch = require('fetch-everywhere');
const { errorHandler, responseHandler } = require('./fetch');
const { DOODLE_ENVS, verboseLogging } = require('../constants');
/**
* Set a password for a Keycloak user.
*
* @param {String} target - staging, devbox, etc
* @param {String} accessToken - The users JWT token
* @returns {Promise}
*/
const getUserInfo = (target, accessToken) => {
const headers = {
Authorization: `Bearer ${accessToken}`,
'Content-Type': 'application/json',
};
const { monolithApiBase } = DOODLE_ENVS[target];
const url = `${monolithApiBase}/v2.0/users/me`;
if (verboseLogging) {
console.log(`GET: ${url}`);
}
return fetch(url, { method: 'GET', headers })
.then(responseHandler)
.catch(errorHandler);
};
module.exports = {
getUserInfo,
};