Skip to content

Authentication​

User registration, login, and session management via AWS Cognito


Register a new user​

POST
/cognito/signup

Create a new account via AWS Cognito. The account is confirmed immediately and a verification link is mailed to the address; the email stays unverified until that link is followed (see GET /cognito/verify-email), and several write endpoints refuse an unverified account. Gated by the features.user_registration flag — when the flag is off the endpoint answers 403. Rate limited to 10 requests per minute per IP. When the risk engine flags the caller (repeated sign-ups from one IP), a reCAPTCHA token must be sent as captchaToken.

Request Body​

application/json
JSON
{
"email": "user@example.com",
"password": "SecureP@ssw0rd!",
"name": "John Doe",
"captchaToken": "string",
"ambassadorInviteToken": "string",
"verifyWith": "string"
}

Responses​

Account created; verification email sent.

application/json
JSON
{
"message": "string",
"userSub": "string",
"userConfirmed": true,
"verification": {
"method": "string",
"length": 6,
"expiresInSeconds": 600,
"maxAttempts": 5,
"resendAfterSeconds": 60
}
}

Playground​

Server
Body

Samples​


Confirm registration​

POST
/cognito/confirm

Confirm a Cognito account with a verification code. Sign-up already confirms the account itself, so this is needed only when POST /cognito/signup answered userConfirmed: false. It does not mark the email verified — that is the link sent by sign-up.

Request Body​

application/json
JSON
{
"email": "string",
"code": "123456"
}

Responses​

Account confirmed

application/json
JSON
{
"message": "string"
}

Playground​

Server
Body

Samples​


Sign in​

POST
/cognito/signin

Authenticate with email and password. Tokens are not returned in the body: the session is set as httpOnly cookies (access_token, id_token, refresh_token) that the browser sends on every later request. Scripts and server-to-server integrations should use an API key instead (see Authentication). When the risk engine flags repeated failures, a reCAPTCHA token must be sent as captchaToken. If Cognito asks for a further challenge, the body carries challengeRequired: true, challengeName and session and no cookies are set.

Request Body​

application/json
JSON
{
"email": "user@example.com",
"password": "string",
"captchaToken": "string"
}

Responses​

Authentication successful; session cookies set.

application/json
JSON
{
"message": "Signin successful",
"user": {
"id": "string",
"email": "string",
"name": "string",
"avatar": "string",
"role": "string",
"email_verified": true,
"created_at": "string",
"profile_slug": "string",
"deletion_scheduled_for": "string"
},
"expiresIn": 0
}

Playground​

Server
Body

Samples​


Refresh tokens​

POST
/cognito/refresh

Exchange the refresh_token cookie for new access and ID token cookies. There is no request body — a refresh token sent in JSON is ignored.

Responses​

Tokens refreshed; new access_token and id_token cookies set.

application/json
JSON
{
"message": "string",
"expiresIn": 0
}

Playground​

Samples​


Sign out​

POST
/cognito/logout

Revoke the session's Cognito tokens (global sign-out) and clear the session cookies. Always answers 200, even without a session.

Responses​

Logged out

application/json
JSON
{
"message": "string"
}

Playground​

Samples​


Get current user​

GET
/cognito/me

The signed-in user's profile. Cookie session only — this endpoint does not accept an Authorization header or an API key. When the short-lived session has expired but the refresh cookie is still valid, it renews the session transparently and sets new cookies. While FundlyHub support is viewing the account on the user's behalf it returns that user with is_impersonating: true and impersonated_by.

Responses​

Current user info

application/json
JSON
{
"user": {
"id": "string",
"email": "string",
"name": "string",
"avatar": "string",
"role": "string",
"email_verified": true,
"created_at": "string",
"profile_slug": "string",
"auth_provider": "string",
"needs_name_update": true,
"deletion_scheduled_for": "string",
"is_impersonating": true,
"impersonated_by": "string"
}
}

Playground​

Samples​


Request password reset​

POST
/cognito/forgot-password

Send a password reset code, preferring the account's verified private contact email. The verified contact or sign-in email can identify the account. With no verified private contact, or where that path cannot serve the account (no usable sign-in identity yet, or an address shared by two accounts), existing Cognito recovery sends the code instead. Answers 200 whether or not an account or deliverable destination exists; it reveals neither account existence nor a private address.

Request Body​

application/json
JSON
{
"email": "string"
}

Responses​

Reset code sent, if the account exists

application/json
JSON
{
"message": "string"
}

Playground​

Server
Body

Samples​


Reset password​

POST
/cognito/reset-password

Set a new password using a reset code. Account-bound application codes contain eight digits, expire after 10 minutes and allow five attempts; they are consumed once, before changing the same Cognito identity's password. Existing Cognito codes remain supported. Recovery never changes email addresses or their verified flags. A federated account retains Apple/Google sign-in when it gains a password option.

The code an address receives is one of two lengths, depending on the account; GET /cognito/auth-policy lists them (passwordResetCode.lengths), the same for every caller, so a code field accepts any of them.

Save and sign in. With signIn: true, a successful reset also signs the person in with the new password: Cognito checks it as POST /cognito/signin does, and the same access_token, id_token and refresh_token httpOnly cookies are set. The answer then carries signedIn. signedIn: false means the reset is done but no session was opened (the account needs a further step); sign in with the new password. Without the flag nothing but the reset happens and no cookie is set.

Request Body​

application/json
JSON
{
"email": "string",
"code": "string",
"newPassword": "string",
"signIn": true
}

Responses​

Password reset

application/json
JSON
{
"message": "string",
"signedIn": true,
"user": {
},
"expiresIn": 0
}

Playground​

Server
Body

Samples​


Initiate OAuth login​

GET
/cognito/oauth/{provider}

Redirect to the Cognito Hosted UI for a third-party provider. After the provider signs the user in, GET /cognito/oauth/callback sets the session cookies and redirects to redirect on the FundlyHub site.

Open this URL in the browser that will be signed in, by navigating to it rather than fetching it. The response sets a short-lived httpOnly cookie that the callback requires. A sign-in completed in a different browser, after about ten minutes, or after a newer sign-in was started in the same browser is refused, and the browser is sent to /auth?error=state_mismatch with no session set; starting again fixes it.

Parameters​

Path Parameters

provider*
Type
string
Required
Valid values
"google""apple"

Query Parameters

redirect

The path on the FundlyHub site to send the browser to after sign-in, such as /campaigns/help-food-bank?tab=updates. It must start with a single /; a full URL on the FundlyHub site is reduced to its path. Any other value, such as a URL on another host or a protocol-relative //host, is replaced by /. Defaults to /.

Type
string
Example"/campaigns/help-food-bank"
Max Length
2048

Responses​

Redirect to the OAuth provider. Sets the short-lived sign-in cookie that the callback checks.

Playground​

Server
Variables
Key
Value

Samples​


Change password​

POST
/cognito/change-password

Changes the password of an email/password account, given the current one.

Cookie session only. A request authenticated with an Authorization: Bearer header or an API key answers 401 Not authenticated. An account that signs in with Google or Apple only has no password to change; it creates one with POST /cognito/set-password.

It works from any of the account's sessions, including one that signed in with Google or Apple: the current password is then checked the way a sign-in checks it.

Rate limited at 10 requests/minute per IP (authentication bucket).

Authorizations​

BearerAuth

In the browser, authentication rides on the httpOnly session cookies set by /cognito/signin or the Google / Apple sign-in at /cognito/oauth/{provider}. For scripts and for Swagger UI testing, paste an API key (fh_live_…, created with POST /api-keys); a Cognito JWT is accepted too. Sign-in does not return a token in its body.

Type
HTTP (bearer)

Request Body​

application/json
JSON
{
"currentPassword": "string",
"newPassword": "string"
}

Responses​

Password changed

application/json
JSON
{
"success": true,
"message": "string"
}

Playground​

Server
Authorization
Body

Samples​


Resend the email-verification link​

POST
/cognito/resend-verification

Sends a fresh verification link to the account registered under email (matched case-insensitively against the login address, not the private contact address — for that use POST /users/me/private-contact/resend).

Always answers 200 with the same message, whether or not the address has an account and even when sending fails, so it cannot be used to discover accounts.

No authentication. Rate limited at 5 requests/minute, keyed by user when a session is present and by IP otherwise.

Request Body​

application/json
JSON
{
"email": "string"
}

Responses​

Accepted (sent if the address is known)

application/json
JSON
{
"message": "If this email exists, a verification link has been sent."
}

Playground​

Server
Body

Samples​


Verify an email address (link target)​

GET
/cognito/verify-email

The URL in verification emails. Consumes the token and always redirects to the frontend with the outcome in a query parameter; it never returns JSON.

?verification= is one of: success; invalid (no token); failed (an unknown token); used (the link was already used); expired (the link has expired); contact_taken (the link proved a private contact address another account already holds); error (unexpected failure).

When the link proved the account's login address, the Cognito email_verified attribute is updated too, and any pending ambassador invitation for that address is settled.

No authentication. Rate limited at 300 requests/minute per IP.

Query Parameters

token*
Type
string
Required

Redirect to {FRONTEND_URL}/verify-email?verification=<outcome>

Server
Variables
Key
Value

OAuth callback (Google / Apple)​

GET
/cognito/oauth/callback

The Cognito Hosted UI's redirect_uri after a Google or Apple sign-in, started at GET /cognito/oauth/{provider}. Not called by API clients directly.

Exchanges code for tokens, provisions or links the profile, sets the access_token, id_token and refresh_token httpOnly cookies, and redirects to the redirect path given when the flow was started (carried in the oauth_flow cookie, not in state), or the frontend root.

A connect round trip (started by POST /cognito/sign-in-methods/{provider}/connect) ends here too, and differently: no session cookie is set and no profile is created or moved. The browser is redirected to the returnPath the connect was started with, with connect_provider and connect_result in the query: connected, email_mismatch (the provider account uses another address), email_not_verified, identity_in_use, cancelled, session_changed (the browser is no longer signed in to the account that started it), expired, or failed. An address is never put in that URL; GET /cognito/sign-in-methods answers it as lastConnect.

Every failure is also a redirect, to {FRONTEND_URL}/auth?error=…: state_mismatch (no oauth_flow cookie in this browser, or state does not match it), unverified_account_exists (a provider identity linked to a native account whose address was never verified), blocked_email_domain (the address fails the sign-up email policy), email_linked_elsewhere (a profile at this address belongs to another sign-in, and this one has not proven the address), missing_code, token_exchange_failed, invalid_token, oauth_error (with a message), or the provider's own error with a message.

Parameters​

Query Parameters

code

Authorization code from Cognito.

Type
string
state

The sign-in's one-time nonce, which must match the oauth_flow cookie that GET /cognito/oauth/{provider} set in this browser.

Type
string
error
Type
string
error_description
Type
string

Responses​

Redirect — on success to the redirect path the sign-in was started with (or /) on the frontend, with the session cookies set; on failure to /auth?error=… on the frontend.

Playground​

Server
Variables
Key
Value

Samples​


Code lengths and limits for the sign-in screens​

GET
/cognito/auth-policy

The numbers a sign-in screen draws and the API enforces, from one place on the server: how many digits the email verification code has and how long it lasts, every length a password reset code can have, the password length bounds, and how recent a sign-in must be to create a password. A client reads them here instead of writing them into a field.

The answer is the same for every caller. In particular passwordResetCode.lengths is the whole set of lengths, never the one a given address would receive, so it says nothing about whether an address has an account.

No authentication. Rate limited at 300 requests/minute per IP. Cacheable for five minutes.

Responses​

The policy

application/json
JSON
"string"

Playground​

Samples​


Ways to sign in to the account​

GET
/cognito/sign-in-methods

Which of Google, Apple and a password the signed-in account has, which one this session signed in with, and when each was added or last changed where that is known. Read from the user pool on every call; 503 SIGN_IN_METHODS_UNAVAILABLE when it cannot be read.

currentMethod is null when it cannot be told for certain (for example a Bearer session that sends no access token); it is never a guess. recentSignIn.fresh says whether this session may create a password now. lastConnect is the result of the last connect round trip, for ten minutes; providerEmail is set only for email_mismatch.

An API key and an admin acting as the user get the list, with currentMethod null, recentSignIn.fresh false and lastConnect null.

canDisconnect / disconnectBlockedReason on each provider say whether DELETE /cognito/sign-in-methods/{provider} would remove it.

Rate limited at 30 requests/minute per account and 60 per IP.

Authorizations​

BearerAuth

In the browser, authentication rides on the httpOnly session cookies set by /cognito/signin or the Google / Apple sign-in at /cognito/oauth/{provider}. For scripts and for Swagger UI testing, paste an API key (fh_live_…, created with POST /api-keys); a Cognito JWT is accepted too. Sign-in does not return a token in its body.

Type
HTTP (bearer)

Responses​

The account's ways to sign in

application/json
JSON
"string"

Playground​

Server
Authorization

Samples​


Create a password on a Google or Apple account​

POST
/cognito/set-password

Gives an account that signs in with Google or Apple only a password as well. The sign-in address and the password then work too; Google and Apple keep working.

Behind the staff switch features.create_password, which is off by default. While it is off this route answers 404, and GET /cognito/sign-in-methods answers canCreatePassword: false; read that field instead of calling this route to find out.

Refused unless all of these hold: the account has no password (to change one, use POST /cognito/change-password with the current password); the session signed in recently, within recentSignIn.maxAgeSeconds of GET /cognito/auth-policy (a token refresh does not count as signing in); the password is inside the length bounds and satisfies the pool policy (upper, lower, digit and symbol).

Needs a real sign-in session: not an API key, and not an admin acting as the user. The change is written to the audit log and the account's owner is emailed a security notice. Rate limited at 30 requests/minute per account and 60 per IP.

Authorizations​

BearerAuth

In the browser, authentication rides on the httpOnly session cookies set by /cognito/signin or the Google / Apple sign-in at /cognito/oauth/{provider}. For scripts and for Swagger UI testing, paste an API key (fh_live_…, created with POST /api-keys); a Cognito JWT is accepted too. Sign-in does not return a token in its body.

Type
HTTP (bearer)

Request Body​

application/json
JSON
{
"newPassword": "string"
}

Responses​

Password created

application/json
JSON
{
"success": true,
"message": "string",
"changedAt": "string"
}

Playground​

Server
Authorization
Body

Samples​


Disconnect Google or Apple​

DELETE
/cognito/sign-in-methods/{provider}

Stops Google or Apple signing in to the account. A provider identity linked into another sign-in is unlinked; a sign-in the provider created that holds nothing else is deleted, and its sessions end with it. Afterwards a sign-in with that provider at the account's address is refused (/auth?error=provider_disconnected) until it is connected again from Settings. The owner is told by email and the change is audited.

Needs a sign-in session (not an API key, not an admin acting as the user). One change per account at a time: 409 SIGN_IN_METHOD_CHANGE_IN_PROGRESS. Rate limited at 30 requests/minute per account and 60 per IP.

Authorizations​

BearerAuth

In the browser, authentication rides on the httpOnly session cookies set by /cognito/signin or the Google / Apple sign-in at /cognito/oauth/{provider}. For scripts and for Swagger UI testing, paste an API key (fh_live_…, created with POST /api-keys); a Cognito JWT is accepted too. Sign-in does not return a token in its body.

Type
HTTP (bearer)

Parameters​

Path Parameters

provider*
Type
string
Required
Valid values
"google""apple"

Responses​

Disconnected; the account's ways to sign in as they are now

application/json
JSON
{
"data": "string"
}

Playground​

Server
Authorization
Variables
Key
Value

Samples​


Start connecting Google or Apple​

POST
/cognito/sign-in-methods/{provider}/connect

Opens a round trip that connects Google or Apple to the signed-in account, and answers the address to open in the provider window. The round trip ends at GET /cognito/oauth/callback, which redirects to returnPath with connect_provider and connect_result; the browser stays signed in as it was.

A provider connects only when the provider account uses the account's own sign-in address, and that address is verified. This is the rule sign-in already links by; another address is refused (email_mismatch) and no account is created for it.

The response sets the short-lived httpOnly oauth_flow cookie the callback requires, so the provider window must be opened by the same browser. One round trip per account is open at a time, each lasts ten minutes, and an account may start ten an hour. A completed connect is written to the audit log and the account's owner is emailed a security notice.

Needs a real sign-in session: not an API key, and not an admin acting as the user. Rate limited at 30 requests/minute per account and 60 per IP.

Authorizations​

BearerAuth

In the browser, authentication rides on the httpOnly session cookies set by /cognito/signin or the Google / Apple sign-in at /cognito/oauth/{provider}. For scripts and for Swagger UI testing, paste an API key (fh_live_…, created with POST /api-keys); a Cognito JWT is accepted too. Sign-in does not return a token in its body.

Type
HTTP (bearer)

Parameters​

Path Parameters

provider*
Type
string
Required
Valid values
"google""apple"

Request Body​

application/json
JSON
{
"returnPath": "string"
}

Responses​

The round trip is open

application/json
JSON
{
"provider": "string",
"authorizeUrl": "string",
"expiresInSeconds": 0
}

Playground​

Server
Authorization
Variables
Key
Value
Body

Samples​


Send an email verification code​

POST
/cognito/email-code/send

Sends the signed-in account's own sign-in address a new verification email with a code to type in and the link. Nothing in the request names an address. A new code replaces the last one. The first code is sent by POST /cognito/signup with verifyWith: code; this is "Resend code".

One code a minute and five an hour per account (429 VERIFICATION_CODE_RATE_LIMITED with retryAfterSeconds and a Retry-After header). After too many wrong codes in total the code path is closed for that address (429 VERIFICATION_CODE_LOCKED) and only the link verifies it.

Needs a real sign-in session. Rate limited at 30 requests/minute per account and 60 per IP.

Authorizations​

BearerAuth

In the browser, authentication rides on the httpOnly session cookies set by /cognito/signin or the Google / Apple sign-in at /cognito/oauth/{provider}. For scripts and for Swagger UI testing, paste an API key (fh_live_…, created with POST /api-keys); a Cognito JWT is accepted too. Sign-in does not return a token in its body.

Type
HTTP (bearer)

Responses​

Sent, or nothing to verify

application/json
JSON
{
"sent": true,
"alreadyVerified": true,
"length": 6,
"expiresInSeconds": 600,
"maxAttempts": 5,
"resendAfterSeconds": 60
}

Playground​

Server
Authorization

Samples​


Confirm the email with a typed code​

POST
/cognito/email-code/confirm

Verifies the signed-in account's sign-in address with the code from the verification email. A right code does exactly what following the link does. A code works once, for ten minutes, for the account it was sent to, and allows five tries.

A wrong or expired code answers 400 INVALID_VERIFICATION_CODE, with attemptsLeft when the try was counted. After too many wrong codes in total: 429 VERIFICATION_CODE_LOCKED; the link in the email still works. An address that is already verified answers 200 with alreadyVerified: true.

Needs a real sign-in session. Rate limited at 30 requests/minute per account and 60 per IP.

Authorizations​

BearerAuth

In the browser, authentication rides on the httpOnly session cookies set by /cognito/signin or the Google / Apple sign-in at /cognito/oauth/{provider}. For scripts and for Swagger UI testing, paste an API key (fh_live_…, created with POST /api-keys); a Cognito JWT is accepted too. Sign-in does not return a token in its body.

Type
HTTP (bearer)

Request Body​

application/json
JSON
{
"code": "string"
}

Responses​

Verified

application/json
JSON
{
"verified": true,
"alreadyVerified": true
}

Playground​

Server
Authorization
Body

Samples​


Powered by VitePress OpenAPI

Built with VitePress