Skip to content

Commit 254f3e4

Browse files
authored
Merge pull request #12 from adobe/cache-access-token
cache fetched access token
2 parents bb8939d + 24ee940 commit 254f3e4

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

bin/fetch.access.token.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,13 @@ const { ENVIRONMENTS } = require('./constants');
1717

1818
const { CLIENT_SECRET, IMS_USER_EMAIL, IMS_USER_ID, IMS_PASSWORD } = process.env;
1919

20+
let accessTokenData = null;
21+
2022
module.exports = async (env = 'prod') => {
23+
if (accessTokenData) {
24+
return accessTokenData;
25+
}
26+
2127
if (!IMS_USER_EMAIL) {
2228
throw new Error('You need to set IMS_USER_EMAIL in your environment');
2329
}
@@ -88,5 +94,7 @@ module.exports = async (env = 'prod') => {
8894
userId = IMS_USER_ID;
8995
}
9096

91-
return { access_token: accessToken, userId };
97+
accessTokenData = { access_token: accessToken, userId };
98+
99+
return accessTokenData;
92100
};

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@adobe/griffon-plugin-tools",
3-
"version": "0.2.0",
3+
"version": "0.2.1",
44
"description": "Tools for packaging and uploading Project Griffon plugins",
55
"repository": {
66
"type": "git",

0 commit comments

Comments
 (0)