UNPKG

slack-edge

Version:

Slack app development framework for edge functions with streamlined TypeScript support

24 lines 1.1 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.generateOIDCAuthorizeUrl = generateOIDCAuthorizeUrl; const errors_1 = require("../errors"); /** * Generates slack.com/openid/connect/authorize URL with sufficient information. * @param state state parameter string * @param env env variables * @returns slack.com/openid/connect/authorize URL */ function generateOIDCAuthorizeUrl(state, env) { if (!env.SLACK_OIDC_SCOPES) { throw new errors_1.ConfigError("env.SLACK_OIDC_SCOPES must be present when enabling Sign in with Slack (OpenID Connect)"); } if (!env.SLACK_OIDC_REDIRECT_URI) { throw new errors_1.ConfigError("env.SLACK_OIDC_REDIRECT_URI must be present when enabling Sign in with Slack (OpenID Connect)"); } let url = `https://slack.com/openid/connect/authorize?response_type=code&state=${state}`; url += `&client_id=${env.SLACK_CLIENT_ID}`; url += `&scope=${env.SLACK_OIDC_SCOPES}`; url += `&redirect_uri=${env.SLACK_OIDC_REDIRECT_URI}`; return url; } //# sourceMappingURL=authorize-url-generator.js.map