mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 05:36:00 +00:00
cloud login WIP
This commit is contained in:
34
packages/api/src/utility/cloudIntf.js
Normal file
34
packages/api/src/utility/cloudIntf.js
Normal file
@@ -0,0 +1,34 @@
|
||||
const axios = require('axios');
|
||||
const { getExternalParamsWithLicense } = require('./authProxy');
|
||||
|
||||
const DBGATE_IDENTITY_URL = process.env.LOCAL_DBGATE_IDENTITY
|
||||
? 'http://localhost:3001'
|
||||
: process.env.DEVWEB || process.env.DEVMODE
|
||||
? 'https://identity.dbgate.udolni.net'
|
||||
: 'https://identity.dbgate.io';
|
||||
|
||||
const DBGATE_CLOUD_URL = process.env.LOCAL_DBGATE_CLOUD
|
||||
? 'http://localhost:3109'
|
||||
: process.env.DEVWEB || process.env.DEVMODE
|
||||
? 'https://cloud.dbgate.udolni.net'
|
||||
: 'https://cloud.dbgate.io';
|
||||
|
||||
async function createDbGateIdentitySession(client) {
|
||||
const resp = await axios.default.post(
|
||||
`${DBGATE_IDENTITY_URL}/api/create-session`,
|
||||
{
|
||||
client,
|
||||
},
|
||||
getExternalParamsWithLicense()
|
||||
);
|
||||
return resp.data.sid;
|
||||
}
|
||||
|
||||
function getIdentitySigninUrl(sid) {
|
||||
return `${DBGATE_IDENTITY_URL}/signin/${sid}`;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
createDbGateIdentitySession,
|
||||
getIdentitySigninUrl,
|
||||
};
|
||||
Reference in New Issue
Block a user