MCPcopy Create free account
hub / github.com/RealDevSquad/website-backend / generateGithubAuthRedirectUrl

Function generateGithubAuthRedirectUrl

test/utils/github.js:4–20  ·  view source on GitHub ↗
({
  baseUrl = "https://github.com/login/oauth/authorize",
  responseType = "code",
  redirectUri = `${baseURL}/auth/github/callback`,
  scope = "user:email",
  state = "",
  clientId = defaultClientId,
})

Source from the content-addressed store, hash-verified

2const baseURL = config.get("services.rdsApi.baseUrl");
3
4const generateGithubAuthRedirectUrl = function ({
5 baseUrl = "https://github.com/login/oauth/authorize",
6 responseType = "code",
7 redirectUri = `${baseURL}/auth/github/callback`,
8 scope = "user:email",
9 state = "",
10 clientId = defaultClientId,
11}) {
12 const encodedBaseUrl = encodeURI(baseUrl);
13 const encodedRedirectUri = encodeURIComponent(redirectUri);
14 const encodedScope = encodeURIComponent(scope);
15 let encodedUrl = `${encodedBaseUrl}?response_type=${responseType}&redirect_uri=${encodedRedirectUri}&scope=${encodedScope}`;
16 if (state) {
17 encodedUrl += `&state=${encodeURIComponent(state)}`;
18 }
19 return `${encodedUrl}&client_id=${clientId}`;
20};
21
22module.exports = { generateGithubAuthRedirectUrl };

Callers 1

auth.test.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected