Debuta supports OAuth sign-in via Google and Facebook. Both flows follow the same pattern: the mobile app completes the OAuth handshake natively usingDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/desarrolladorandres2026-gif/Native-tailwind/llms.txt
Use this file to discover all available pages before exploring further.
expo-auth-session, receives a provider token, and exchanges it with the Debuta backend for a signed JWT. The backend verifies the token directly with the provider (Google’s OAuth2Client or Facebook’s Graph API), then creates or updates the user record before returning the Debuta session token.
The mobile app handles the OAuth redirect entirely on-device using
expo-auth-session. The backend endpoints documented here accept only the resulting provider token — they do not perform any redirects themselves.POST /api/auth/google
Verifies a Google ID token, then finds or creates a Debuta user. The Google token is verified againstGOOGLE_CLIENT_ID using the google-auth-library OAuth2Client. If the email already exists in the database with a different provider, the Google identity is linked to that account.
Auth required: No
Request body
The Google ID token returned by
expo-auth-session / Google Sign-In on the mobile client. This is verified server-side with Google’s public keys.Response — 200 OK
Signed Debuta JWT, valid for 7 days.
Serialized user profile. See UserObject fields.
Present and
true when the account was just created and the user has not yet set a real gender or birth_date. The app should navigate these users to a profile-completion screen before showing the main feed.New-user creation details
When no existing account matches the Googlesub (ID) or email, the backend automatically creates an account with:
auth_provider: 'google',googleIdset to the Googlesubusernamegenerated from the user’s given name plus a random 4-digit suffixprofile_pictureset from the Google account photo (if available)is_verified: true(Google-verified email)needs_profile_completion: truegender: 'prefiero_no_decir'andbirth_date: 2000-01-01as placeholders until the user fills in their profile
Error responses
| Status | Condition |
|---|---|
400 | idToken missing from request body |
401 | Token verification failed with Google / invalid token |
401 | Account is deactivated |
curl example
POST /api/auth/facebook
Verifies a Facebook user access token via the Graph APIdebug_token endpoint, fetches the user’s profile, and finds or creates a Debuta account. If the email is already registered under a different provider, the Facebook identity is linked.
Auth required: No
Request body
The Facebook user access token from
expo-auth-session / Facebook Login SDK.The Facebook user ID (
id field from the Graph API). Used to fetch the user’s profile data from graph.facebook.com/{userID}.Response — 200 OK
Signed Debuta JWT, valid for 7 days.
Serialized user profile. See UserObject fields.
true for newly created Facebook accounts that still need gender and birth date.New-user creation details
When no existing account matches the Facebookid or email, the backend creates an account with:
auth_provider: 'facebook',facebookIdset- Email: the Facebook account email, or
fb_<facebookId>@debuta.appas a fallback if Facebook doesn’t provide one profile_pictureset from the Facebook large profile picture (if available)is_verified: true,needs_profile_completion: true- Placeholder
genderandbirth_dateuntil the user completes the profile
Error responses
| Status | Condition |
|---|---|
400 | accessToken missing from request body |
401 | debug_token validation failed — token is not valid |
401 | Account is deactivated |
500 | Error communicating with the Facebook Graph API |
curl example
POST /api/auth/social/friends
Stores a list of the authenticated user’s Facebook friend IDs so that the discovery algorithm can surface mutual connections. The IDs are stored in thesocial_friend_ids array on the user document and are never exposed to other users directly.
Auth required: Yes — Authorization: Bearer <token>
Request body
Array of Facebook user IDs for the current user’s friends. Send the full list each time — the call replaces the previous value with
$set.Response — 200 OK
Confirmation message.
Number of friend IDs stored.
Error responses
| Status | Condition |
|---|---|
401 | Missing or invalid JWT |
500 | Internal server error |
curl example
GET /api/auth/common-connections/:userId
Computes and returns a connection-strength score between the authenticated user and the target user. This is the same affinity algorithm used by the discovery feed. The response includes a breakdown of shared Facebook friends on Debuta, common interests, city match, and age proximity — plus a pre-formatted summary string ready to display in the UI. Auth required: Yes —Authorization: Bearer <token>
Path parameters
MongoDB ObjectId of the target user to compare against.
Response — 200 OK
Number of Facebook friend IDs that appear in both users’
social_friend_ids arrays and are registered Debuta accounts.Array of interest names shared between both users.
true if both users have the same ciudad value (case-insensitive).true if both users share the same pais value (case-insensitive).true if the age difference between both users is 5 years or less.Composite affinity score. Scoring weights:
amigosFB × 3, interesesComun × 2, ciudadComun +2, paisComun +1, edadSimilar +1.Human-readable summary for the UI (e.g.
"2 amigos en común · misma ciudad"). null if no connections exist.Error responses
| Status | Condition |
|---|---|
401 | Missing or invalid JWT |
404 | Target user not found |
500 | Internal server error |
curl example
OAuth flow overview
Google Sign-In
The app calls
expo-auth-session with responseType: 'id_token'. The resulting idToken is sent to POST /api/auth/google for server-side verification via google-auth-library.Facebook Login
The app uses
expo-auth-session with the Facebook provider. Both the accessToken and userID returned by the SDK are forwarded to POST /api/auth/facebook. The backend cross-checks the token with graph.facebook.com/debug_token before trusting it.