@softr/sdk
Version:
The SDK for building Softr apps on TanStack Start. It lets an app interact with Softr: auth, datasources, workflows and integrations.
38 lines (36 loc) • 1.27 kB
TypeScript
import { User } from "../user.js";
import { AuthError, Result } from "./utils.js";
//#region src/auth/methods/social.d.ts
/**
* Signs a visitor in with a Google token the browser obtained, creating their
* account the first time.
*
* Pass the id token Google Identity Services handed the page. An access token
* is rejected, and so is a token minted for another app. `fullName` names a
* first-time visitor and does nothing for one who already has an account.
*
* A `signedIn` result means the visitor is signed in. An app that also asks for
* an authenticator app answers `authenticatorRequired` instead, naming the step
* to send them to next.
*
* It fails as `notEnabled` when the app's plan no longer includes Google
* sign-in, as after a downgrade.
*/
declare function signInWithGoogle(credentials: {
email: string;
token: string;
fullName?: string;
}): Promise<Result<{
status: "signedIn";
user: User;
} | {
status: "authenticatorRequired";
/**
* `verify`: they have an authenticator app and owe a code.
* `setup`: the app requires one and they have none yet.
* `setupOptional`: same, except they may skip it instead.
*/
step: "verify" | "setup" | "setupOptional";
}, AuthError>>;
//#endregion
export { signInWithGoogle };