Add appstore web token

* For existing installs, migrate using the soon to be obsoleted user_token route
* For new installs, the token post login is stashed during registration time
This commit is contained in:
Girish Ramakrishnan
2022-03-31 22:04:52 -07:00
parent 656dca7c66
commit ad2221350f
5 changed files with 71 additions and 26 deletions
+4 -4
View File
@@ -5,7 +5,7 @@ exports = module.exports = {
getApp,
getAppVersion,
createUserToken,
getWebToken,
registerCloudron,
getSubscription
};
@@ -45,11 +45,11 @@ async function getAppVersion(req, res, next) {
next(new HttpSuccess(200, manifest));
}
async function createUserToken(req, res, next) {
const [error, accessToken] = await safe(appstore.createUserToken());
async function getWebToken(req, res, next) {
const [error, accessToken] = await safe(appstore.getWebToken());
if (error) return next(BoxError.toHttpError(error));
next(new HttpSuccess(201, { accessToken }));
next(new HttpSuccess(200, { accessToken }));
}
async function registerCloudron(req, res, next) {