mirror of
https://github.com/serverless/serverless.git
synced 2025-12-08 19:46:03 +00:00
20 lines
514 B
JavaScript
20 lines
514 B
JavaScript
'use strict';
|
|
|
|
const configUtils = require('./config');
|
|
|
|
function getAuthToken() {
|
|
if (process.env.SERVERLESS_TOKEN) {
|
|
return process.env.SERVERLESS_TOKEN;
|
|
}
|
|
|
|
const userConfig = configUtils.getConfig();
|
|
const currentId = userConfig.userId;
|
|
const globalConfig = configUtils.getGlobalConfig();
|
|
if (globalConfig.users && globalConfig.users[currentId] && globalConfig.users[currentId].auth) {
|
|
return globalConfig.users[currentId].auth.id_token;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
module.exports = getAuthToken;
|