UNPKG

@neurosity/sdk

Version:
19 lines (18 loc) 963 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.createOAuthURL = void 0; const axios_1 = __importDefault(require("axios")); const utils_1 = require("./utils"); function createOAuthURL(config, sdkOptions) { const { clientId, clientSecret, responseType, redirectUri, scope, state } = config; const baseUrl = (0, utils_1.getFunctionsBaseURL)(sdkOptions); return axios_1.default .get(`${baseUrl}/authorize/entry`, { params: Object.assign(Object.assign({ client_id: clientId }, (clientSecret ? { client_secret: clientSecret } : {})), { response_type: responseType, redirect_uri: redirectUri, scope: scope.join(","), state: state, redirect: "false" }) }) .then((response) => `${baseUrl}${response.data.url}`); } exports.createOAuthURL = createOAuthURL;