MCPcopy Create free account
hub / github.com/boringstack-xyz/boringstack / getCredentials

Function getCredentials

apps/api/src/lib/oauth/oauth.utils.ts:48–67  ·  view source on GitHub ↗
(provider: OAuthProvider)

Source from the content-addressed store, hash-verified

46 * billing routes when `BILLING_ENABLED=false`.
47 */
48export const getCredentials = (provider: OAuthProvider): IOAuthCredentials => {
49 const keys = OAUTH_ENV_KEYS[provider];
50 const clientId = env[keys.id];
51 const clientSecret = env[keys.secret];
52
53 if (
54 typeof clientId !== "string" ||
55 clientId === "" ||
56 typeof clientSecret !== "string" ||
57 clientSecret === ""
58 ) {
59 throw ApiErrors.notFound(`OAuth provider '${provider}'`);
60 }
61
62 return {
63 clientId,
64 clientSecret,
65 redirectURI: buildRedirectURI(provider),
66 };
67};
68
69/*
70 * ---------------------------------------------------------------------------

Callers 3

createAuthorizationURLFunction · 0.90
completeOAuthCallbackFunction · 0.90

Calls 1

buildRedirectURIFunction · 0.85

Tested by

no test coverage detected