MCPcopy Index your code
hub / github.com/monkeytypegame/monkeytype / signInWithProvider

Function signInWithProvider

frontend/src/ts/auth.tsx:218–242  ·  view source on GitHub ↗
(
  authMethod: AuthMethod,
  options: { rememberMe: boolean },
)

Source from the content-addressed store, hash-verified

216}
217
218export async function signInWithProvider(
219 authMethod: AuthMethod,
220 options: { rememberMe: boolean },
221): Promise<AuthResult> {
222 if (!isAuthAvailable()) {
223 return { success: false, message: "Authentication uninitialized" };
224 }
225
226 const provider = getAuthProvider(authMethod);
227 if (provider === undefined) {
228 return {
229 success: false,
230 message: `Authentication ${authMethod} is missing a provider`,
231 };
232 }
233
234 const { error } = await tryCatch(
235 signInWithPopup(provider, options.rememberMe),
236 );
237
238 if (error !== null) {
239 return { success: false, message: error.message };
240 }
241 return { success: true };
242}
243
244export async function addAuthProvider(authMethod: AuthMethod): Promise<void> {
245 if (!isAuthAvailable()) {

Callers 1

LoginFunction · 0.90

Calls 4

isAuthAvailableFunction · 0.90
tryCatchFunction · 0.90
signInWithPopupFunction · 0.90
getAuthProviderFunction · 0.85

Tested by

no test coverage detected