MCPcopy Create free account
hub / github.com/Kong/insomnia / getGitLabConfig

Function getGitLabConfig

packages/insomnia/src/sync/git/providers/gitlab.ts:53–82  ·  view source on GitHub ↗

* Get GitLab OAuth configuration

()

Source from the content-addressed store, hash-verified

51 * Get GitLab OAuth configuration
52 */
53async function getGitLabConfig() {
54 // Validate and use the environment variables if provided
55 if (
56 (INSOMNIA_GITLAB_REDIRECT_URI && !INSOMNIA_GITLAB_CLIENT_ID) ||
57 (!INSOMNIA_GITLAB_REDIRECT_URI && INSOMNIA_GITLAB_CLIENT_ID)
58 ) {
59 throw new Error('GitLab Client ID and Redirect URI must both be set.');
60 }
61
62 if (INSOMNIA_GITLAB_REDIRECT_URI && INSOMNIA_GITLAB_CLIENT_ID) {
63 return {
64 clientId: INSOMNIA_GITLAB_CLIENT_ID,
65 redirectUri: INSOMNIA_GITLAB_REDIRECT_URI,
66 };
67 }
68
69 const configResponse = await net.fetch(getApiBaseURL() + '/v1/oauth/gitlab/config', {
70 method: 'GET',
71 });
72
73 const { applicationId: clientId, redirectUri } = (await configResponse.json()) as {
74 applicationId: string;
75 redirectUri: string;
76 };
77
78 return {
79 clientId,
80 redirectUri,
81 };
82}
83
84/**
85 * Base64 URL encode helper for PKCE

Callers 3

initiateOAuthMethod · 0.85
completeOAuthMethod · 0.85
renewCredentialMethod · 0.85

Calls 3

getApiBaseURLFunction · 0.90
fetchMethod · 0.80
jsonMethod · 0.80

Tested by

no test coverage detected