TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/akevalion/life_cost/llms.txt
Use this file to discover all available pages before exploring further.
/google_login endpoint is the single entry point for authentication in Life Cost. It uses Flask-Dance’s Google OAuth 2.0 integration to verify the user’s identity via their Google account. No existing session or credentials are required to reach this endpoint — it is intentionally public so that unauthenticated users can be directed here to sign in.
Authentication
No authentication is required. This endpoint is the OAuth entry point and is accessible without a session cookie.The root route (
/) automatically redirects unauthenticated visitors to /google_login. You do not need to link directly to this endpoint in most cases — simply directing the user to / is sufficient to trigger the login flow.Behavior
The endpoint follows a two-stage flow depending on whether the OAuth handshake has already completed.Stage 1 — Not yet authorized
Ifgoogle.authorized is False (i.e. no OAuth token exists in the current session), the user is immediately redirected to Google’s OAuth consent screen via Flask-Dance’s generated /login/google route. Google handles credential verification and, on success, redirects back to this endpoint with an authorization code.
Stage 2 — Authorized
Oncegoogle.authorized is True, the endpoint:
- Fetches the authenticated user’s profile from the Google API:
- Extracts
name,email, andpicturefrom the response. - Looks up the user by email in the database.
- New user — Creates a new
Userrecord withusernameset to the Google display name,email, andpicture(avatar URL). The new user is appended to all existing wallets via theuser_walletjoin table, andlast_visited_wallet_idis set to the first available wallet’s ID. - Existing user — No fields are updated. The existing
username,email, andpicturevalues are left unchanged.
- New user — Creates a new
- Calls
login_user(user)to establish the Flask-Login session cookie. - Redirects to
/(theviews.indexroute).
User record fields
| Field | Source | Notes |
|---|---|---|
username | Google name | Set at first login only; not updated on re-login |
email | Google email | Used as the unique lookup key; never updated after creation |
picture | Google picture | Avatar URL; set at first login only; not updated on re-login |
Example
Navigating to the endpoint in a browser triggers the full flow. There is no JSON request body.302 redirect to /.
New users are automatically added to all wallets that exist in the database at the time of their first login. Wallets created after the user’s first sign-in are similarly added to all existing users when
POST /add_wallet is called.