(state: string)
| 1 | export const REDIRECT_URI = `${process.env.PD_API_ENDPOINT || ""}/oauth2`; |
| 2 | |
| 3 | export function googleAuthUrl(state: string) { |
| 4 | const url = new URL("https://accounts.google.com/o/oauth2/auth"); |
| 5 | |
| 6 | const CLIENT_ID = "259796927285-cdkkp6i69elf660ei3strgj0qrftu6ud.apps.googleusercontent.com"; |
| 7 | const SCOPES = ["https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/userinfo.profile"]; |
| 8 | |
| 9 | let redirect_uri = REDIRECT_URI; |
| 10 | if ( |
| 11 | process.env.PD_API_ENDPOINT === "http://localhost:6060" || |
| 12 | process.env.PD_API_ENDPOINT === "http://127.0.0.1:6060" |
| 13 | ) { |
| 14 | redirect_uri = "https://stg-app.paperdebugger.com/oauth2"; |
| 15 | } |
| 16 | url.searchParams.set("client_id", CLIENT_ID); |
| 17 | url.searchParams.set("redirect_uri", redirect_uri); |
| 18 | url.searchParams.set("response_type", "token"); |
| 19 | url.searchParams.set("scope", SCOPES.join(" ")); |
| 20 | url.searchParams.set("prompt", "select_account"); // Force account selection dialog |
| 21 | url.searchParams.set("state", state); |
| 22 | return url.toString(); |
| 23 | } |
| 24 | |
| 25 | export function appleAuthUrl(state: string) { |
| 26 | // const options: SignInWithAppleOptions = { |
no test coverage detected