Files
cloudron-box/migrations/20250713133718-oidcClients-separate-ids-for-oidc-proxyauth.js
T
Girish Ramakrishnan bf8a5e6a11 oidc: separate clients for oidc and proxyAuth
in e2e, our test app has both. in such cases, the auth fails because
the redirect URI does not match
2025-07-13 15:51:39 +02:00

19 lines
563 B
JavaScript

'use strict';
exports.up = async function (db) {
const allApps = await db.runSql('SELECT * FROM apps');
for (const app of allApps) {
const manifest = JSON.parse(app.manifestJson);
// assume apps only have one of them
if (manifest.addons.oidc) {
await db.runSql('UPDATE oidcClients SET id=? WHERE id=?', [ `${app.id}-oidc`, app.id ]);
} else {
await db.runSql('UPDATE oidcClients SET id=? WHERE id=?', [ `${app.id}-proxyauth`, app.id ]);
}
}
};
exports.down = async function (db) {
};