Fiuby Developer Documentation
Add Fiuby sign-in to your game or website. Learn the steps for the ready web button, account linking and technical OAuth integration.
Add a ready sign-in button to your game or website
The button opens a Fiuby sign-in window, asks for permission and supplies the approved username, display name, picture and email. You choose which information to request. No game callback address registration is needed.
What does the ready button provide?
Opening sign-in and displaying the approved profile requires no server setup or backend code of your own. Fiuby servers handle this part; you do not put a secret key in your HTML.
The button alone does not create a persistent account in your app, save progress to the cloud or grant access to private data. Those features need a backend integration that securely verifies the Fiuby identity and connects it to your storage system.
Services such as Firebase and Unity Authentication offer ready verification connectors for Google sign-in. Fiuby currently has no equivalent ready account connectors for these services or PlayFab. Secure account and save integration requires additional work.
Create your app using “Ready web/game button” in the developer portal. Open “Copy button code” in the app menu and paste it into your HTML. It works over HTTPS or localhost, including inside iframes.
Copy button code<button type="button" data-fiuby-client-id="YOUR_CLIENT_ID"
data-fiuby-scopes="openid profile display_name avatar" data-fiuby-locale="en"
style="border:0;border-radius:8px;padding:9px 14px;max-width:100%;white-space:normal;background:#287de0;color:white;font:600 14px system-ui;cursor:pointer">Sign in with Fiuby</button>
<script src="https://fiuby.com/sdk/fiuby-login.js"></script>
<script>
window.addEventListener('fiuby:login', function (event) {
const player = event.detail.user;
// player.sub, player.preferred_username, player.name, player.picture, player.email
window.fiubyPlayer = player;
window.dispatchEvent(new CustomEvent('game:login', { detail: player }));
});
window.addEventListener('fiuby:logout', function () {
window.fiubyPlayer = null;
window.dispatchEvent(new CustomEvent('game:logout'));
});
</script>Use game:login to display a profile. To restore progress on another device, follow Account linking below; adding the button alone does not create cloud saves.
The ready SDK supports websites and web/iframe games: HTML5, three.js and the HTML templates of Unity and Godot web exports. Ready native engine plugins for Unity, Unreal or Godot desktop/mobile apps are currently unavailable.
What do you want to do?
Display the player’s name and profile
Add the ready button and use player from game:login. You do not need to write a backend for this. The information is for displaying a profile; it does not by itself authorize access to private database records.
Link an account and continue on another device
Link a verified Fiuby identity to a game account and store progress under that account. You can use existing storage, but must add a trusted verification integration that accepts Fiuby. The Firebase bridge below is one example.
Place the button in your game
Place the HTML button in Settings → Account or your sign-in area. If you already have other sign-in options, add it alongside them; Google is not required. Keep the script sections once at the end of the page. Replace the example’s inline style with your CSS class to match your design.
What can I do without a backend?
Welcome players by name, show their picture and personalize the interface. Existing local saves can keep working, but they may disappear when browser data is cleared and do not transfer to another device. Fiuby sign-in does not turn a local save into a cloud save.
Do persistent accounts require renting a server?
No. A backend is the trusted part that verifies identities and manages data securely. Your own server or a suitable managed service can handle it. The service still needs an integration to accept Fiuby sign-in; check the authentication and execution capabilities of its free plan separately. Fiuby does not provide cloud saves or ready connectors for every platform.
How does this differ from Google sign-in?
Google alone does not store game progress either. Sign-in verifies identity; the game or its data service stores saves. Connecting Google directly to your own account system also requires trusted token verification.
The practical difference is ready integrations: services such as Firebase Authentication and Unity Authentication offer connectors that verify Google sign-in and turn it into their own user sessions. Developers can start without writing their own verification server; save storage still needs separate setup. Fiuby currently has no equivalent ready connectors. Its sign-in button is easy, but secure account/save integration takes more work than using a ready Google connector. Choosing Unity or Unreal alone does not remove this requirement.
Link accounts and restore progress
A Fiuby identity and a game account are different things. Fiuby verifies the user; your game database stores scores, levels and saves. Map verified issuer + sub to the account; names, email and login tokens are not save keys. You can add a fiubySub field to a player record, but a browser-supplied ID alone does not prove account ownership. Create the link only after trusted backend verification.
- When the player first links Fiuby, preserve their current guest game account. Your server connects the verified Fiuby identity to that game account.
- Signing in with the same Fiuby account finds the old game account. If a different save exists, let the player choose current or account progress; never add scores or overwrite silently.
- Load the chosen save with your existing game code. Back up both prior saves and ask again if either changes while the choice is open. If you also use other sign-in providers, securely linking them to the same game account should open the same save.
Optional example: a Firebase account bridge
This is a Cloud Functions bridge you deploy to your own project, rather than a ready Firebase sign-in provider. It requires the Blaze plan and cannot be deployed on the Spark free plan alone. Firebase or Cloud Functions is not a general requirement for Fiuby sign-in; another trusted backend can perform verification. The bridge verifies Fiuby tokens and maps the identity to a Firebase UID. For an existing save under another UID, it returns requiresChoice before issuing a Firebase session after the player’s selection.
Download the Firebase example projectFollow the included README: change the client ID and deploy functions and database rules to your own Firebase project. The reference uses PixelWar’s score/palette/sketch save model; adapt it to your game. Blaze charges based on usage; review its cost conditions before deployment.
Initialize Firebase and wait for anonymous game auth. showProgressChoice is your game's save picker and returns current, saved or null on cancellation. The package includes progress-choice.js/HTML as a reference. Replace game_saves with your save path.
const fiubyLogin = Fiuby.create({
clientId: 'YOUR_CLIENT_ID',
scopes: ['openid', 'profile', 'display_name', 'avatar'],
locale: 'en'
});
// Button markup: <button id="linkFiuby">Fiuby</button>
const button = document.getElementById('linkFiuby');
button.onclick = async () => {
button.disabled = true;
try {
const session = await fiubyLogin.login();
const call = firebase.app().functions('europe-west1').httpsCallable('connectFiuby');
const proof = { accessToken: session.accessToken, idToken: session.idToken };
let result = await call(proof);
while (result.data.requiresChoice) {
const strategy = await showProgressChoice(result.data.progress);
if (!strategy) return; // Cancel: keep the current session and save.
result = await call({ ...proof, progressChoice: {
strategy, revision: result.data.revision, selectionId: result.data.selectionId
}});
}
await firebase.auth().signInWithCustomToken(result.data.customToken);
const uid = firebase.auth().currentUser.uid;
const save = (await firebase.database()
.ref('game_saves/' + uid).once('value')).val();
// Apply save using your game's existing load function.
} catch (error) {
alert(error.message);
} finally {
button.disabled = false;
}
};If you use your own server
Send the SDK session’s accessToken and idToken to your server over HTTPS. Verify the ID token signature, issuer, audience, expiry and at_hash, then call UserInfo to check current validity and matching sub. Only then create a game session and load the save. A browser-supplied sub or email alone is not proof of identity.
Test before publishing
- Make progress as a guest, then link Fiuby: the current progress must remain.
- Sign out and sign back in with Fiuby: restore the same save. Also test a private window or another device.
- If you use other sign-in providers, test those too: providers linked to one game account should open the same save. For an existing save under another UID, test current/account progress and cancellation. Do not automatically add scores.
- If another device changes a save during selection, reject the stale choice and ask again. Failed sign-in, cancellation and retries must not delete saves or duplicate scores.
A prompt to give your AI
Add Fiuby sign-in to this web game or website. Inspect the current setup first and ask whether we need only profile display or persistent accounts and cloud saves. For profile display, use the ready Fiuby SDK button and game:login; do not pretend a backend or cloud saves have been set up. Place a responsive button in Settings/Account or the sign-in area, alongside other options if present. Do not assume we use Google. For persistent accounts, check whether the existing backend can securely verify Fiuby tokens; do not assume a ready connector exists. Explain required services and cost conditions before implementing them. Verify accessToken and idToken on the server using signature, issuer, audience, expiry, at_hash and UserInfo. Map issuer + sub to the existing game account. Preserve guest progress on first link and restore the same save later. If present, securely link other providers to the same game account. Never store login tokens in the database/localStorage or merge by email/name. If we choose the Firebase example bridge, explain that Cloud Functions requires Blaze, adapt it to our save model and document security rules and deployment. For an existing save under another account, clearly compare both saves and let the user choose. Do not switch sessions, combine data or overwrite before selection. Back up both saves, reject stale choices and ask again with current data; retries must not apply the same change twice. Test first link, another device, other providers if present, cancellation, network errors and retries without deleting real saves.Standard server OAuth integration and technical reference
1. Overview
Fiuby supports the standard OAuth 2.0 Authorization Code Flow with PKCE. This allows users to securely grant your application access to their Fiuby profile without sharing their passwords.
We use OpenID Connect (OIDC) on top of OAuth 2.0, meaning you can retrieve an id_token to verify the user's identity securely.
2. Creating an App
- Go to your Settings > Developer Portal.
- Click Create New Application.
- Provide an App Name, Logo, and a list of valid Redirect URIs.
- Save your
client_id. Confidential applications also receive aclient_secret, displayed only once.
3. Authentication Flow
Step 1: Redirect the user to Fiuby
Redirect your users to the authorization endpoint: Previously approved permissions are reused automatically; additional permissions require approval again. Users can remove access under Settings → Authorized applications.
GET https://fiuby.com/oauth/authorize?
client_id=YOUR_CLIENT_ID
&redirect_uri=YOUR_REDIRECT_URI
&response_type=code
&scope=openid%20profile%20email%20avatar%20display_name
&state=RANDOM_SESSION_BOUND_STATE
&nonce=RANDOM_SESSION_BOUND_NONCE
&code_challenge=BASE64URL_SHA256_OF_VERIFIER
&code_challenge_method=S256Step 2: Exchange Code for Tokens
After the user authorizes, they will be redirected back to your redirect_uri with a code. Exchange this code for tokens:
POST https://api.fiuby.com/v1/oauth/token
Content-Type: application/x-www-form-urlencoded
grant_type=authorization_code
&client_id=YOUR_CLIENT_ID
&client_secret=YOUR_CLIENT_SECRET
&code=AUTH_CODE_RECEIVED
&redirect_uri=YOUR_REDIRECT_URI
&code_verifier=YOUR_PKCE_VERIFIERS256 PKCE is required for both client types. Confidential clients also authenticate with their secret; public clients must omit it.
Step 3: Fetch User Info
Use the received access_token to get the user's profile data:
GET https://api.fiuby.com/v1/oauth/userinfo
Authorization: Bearer YOUR_ACCESS_TOKENA UserInfo response with all permissions approved:
{
"sub": "123",
"preferred_username": "player",
"name": "Fiuby Player",
"picture": "https://cdn.fiuby.com/example/avatar.webp",
"email": "[email protected]",
"email_verified": true
}4. Discovery Endpoints
https://api.fiuby.com/.well-known/openid-configurationhttps://api.fiuby.com/.well-known/jwks.json5. Validation and scopes
Generate fresh random state, nonce and a 43–128 character code_verifier for each login and bind them to the login session. code_challenge is the base64url-encoded SHA-256 digest of the verifier, without padding. Match state on callback. Validate the ID token signature against JWKS and check iss, aud, exp and nonce. Identify users by sub; decoding a token is not verification.
openid: ID token; profile: username (preferred_username); email: email and verification status; avatar: profile picture URL (picture); display_name: display name (name). sub is always included in UserInfo. Only fields for requested and approved permissions are returned. If a profile picture or display name is not set, its claim is omitted. An ID token is issued only for openid. The access token is a separate opaque value usable only at userinfo.
Authorization codes expire in 5 minutes and can be exchanged once. Tokens expire in 1 hour. This version supports authorization_code only; refresh_token and offline_access are not supported. Start a new authorization after expiry. Deleting an application revokes its access tokens.
{
"access_token": "OPAQUE_ACCESS_TOKEN",
"id_token": "SIGNED_ID_TOKEN",
"token_type": "Bearer",
"expires_in": 3600,
"scope": "avatar display_name email openid profile"
}{
"sub": "123",
"preferred_username": "player",
"email": "[email protected]",
"email_verified": true
}6. Error responses
Denial returns error=access_denied and state to the registered callback. Invalid callbacks are never followed. The token endpoint returns invalid_request, unsupported_grant_type, invalid_client or invalid_grant; UserInfo returns 401 invalid_token for invalid tokens. OAuth responses have no data envelope. Never put secrets, codes or tokens in logs or public client code; exchange codes using POST.
{
"error": "invalid_grant",
"error_description": "Invalid or expired authorization code"
}