Skip to main content

Documentation 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.

The /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

If google.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

Once google.authorized is True, the endpoint:
  1. Fetches the authenticated user’s profile from the Google API:
    GET https://www.googleapis.com/oauth2/v1/userinfo
    
  2. Extracts name, email, and picture from the response.
  3. Looks up the user by email in the database.
    • New user — Creates a new User record with username set to the Google display name, email, and picture (avatar URL). The new user is appended to all existing wallets via the user_wallet join table, and last_visited_wallet_id is set to the first available wallet’s ID.
    • Existing user — No fields are updated. The existing username, email, and picture values are left unchanged.
  4. Calls login_user(user) to establish the Flask-Login session cookie.
  5. Redirects to / (the views.index route).

User record fields

FieldSourceNotes
usernameGoogle nameSet at first login only; not updated on re-login
emailGoogle emailUsed as the unique lookup key; never updated after creation
pictureGoogle pictureAvatar 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.
# Open in a browser or use curl with redirect following enabled
curl -L https://your-domain.com/google_login
After a successful OAuth handshake, the response is an HTTP 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.

Build docs developers (and LLMs) love