MojiApp

Prijava s MojiAppSign in with MojiApp

Prijava na stranice i aplikacije bez nove lozinke. Korisnik potvrdi prijavu u MojiAppu na mobitelu i sam bira koji profil i koje podatke stranica dobiva. Sign in to websites and apps without a new password. The user approves in MojiApp on their phone and chooses which profile and which data the site receives.

Za korisnike

  1. Na stranici koja nudi prijavu odaberete „Prijava s MojiApp”. Pokaže se QR kod (na računalu) ili gumb „Otvori MojiApp” (na mobitelu).
  2. Skenirate kod u MojiAppu ili dodirnete gumb. MojiApp pokaže tko vas prijavljuje i na koju se adresu vraćate.
  3. Odaberete profil s kojim se prijavljujete — listanjem lijevo-desno. Ako ih imate manje od pet, možete odmah dodati novi.
  4. Ako stranica traži podatke (e-mail, telefon, adresu…), vidite točno koje i za svaki neobavezni sami odlučite. Tek tada potvrdite.
  5. Preglednik sam nastavi — stranica vas je prijavila.

Što stranica dobiva, a što ne

  • Nikad lozinku — lozinke nema; prijavu potvrđujete na svom mobitelu.
  • Svaki profil je druga osoba. Stranica vas s različitim profilima vidi kao različite korisnike i ne može ih povezati. Druga stranica vas, čak i s istim profilom, vidi pod drugom oznakom.
  • Ime profila dobiva ako ga traži — ne vaše ime s dokumenta.
  • Podatke s dokumenta (ime i prezime, OIB, datum rođenja, punoljetnost) može dobiti samo ako ste verificirani i samo ako na njih pristanete.
  • Neke stranice primaju samo verificirane korisnike. MojiApp vam to kaže odmah i nudi verifikaciju.

Gdje sam prijavljen i odjava

U MojiAppu: Postavke → Uređaji i pristup → Prijave s MojiApp. Ondje su sve stranice na koje ste prijavljeni i na kojima ste bili, po profilu, s poveznicom na stranicu i gumbom „Odjavi me”. Nakon odjave stranica više ne dobiva vaše podatke; stranica koja to podržava odjavi vas i u svojoj sesiji, a za ostale MojiApp kaže da se odjavite i na samoj stranici.

Same podatke možete povući i u Postavke → Uređaji i pristup → Privole.

For users

  1. On a site that offers it, choose “Sign in with MojiApp”. You will see a QR code (on a computer) or an “Open MojiApp” button (on a phone).
  2. Scan the code in MojiApp or tap the button. MojiApp shows who is signing you in and where you will be sent back.
  3. Choose the profile you sign in with by swiping left and right. If you have fewer than five, you can add a new one right there.
  4. If the site asks for data (email, phone, address…), you see exactly which, and you decide on each optional item. Only then do you approve.
  5. The browser continues on its own — you are signed in.

What the site gets, and what it doesn’t

  • Never a password — there is none; you approve on your own phone.
  • Each profile is a different person. The site sees you as different users with different profiles and cannot link them. Another site sees you under a different identifier, even with the same profile.
  • The profile name, if it asks — not your name from your document.
  • Document data (full name, national ID number, date of birth, being of age) only if you are verified and only if you agree.
  • Some sites accept only verified users. MojiApp tells you right away and offers verification.

Where am I signed in, and signing out

In MojiApp: Settings → Devices and access → Sign-ins with MojiApp. It lists every site you are or were signed in to, per profile, with a link to the site and a “Sign me out” button. After that the site no longer receives your data; a site that supports it also ends its own session, and for others MojiApp tells you to sign out on the site itself.

You can also withdraw just the data in Settings → Devices and access → Consents.

Za razvojne programere

„Prijava s MojiApp” je standardni OAuth 2.0 / OpenID Connect (authorization code). Radi s bilo kojom OIDC bibliotekom.

1. Registrirajte aplikaciju

U MojiAppu: Postavke → Uređaji i pristup → Moje OAuth aplikacije (za razvoj) → +. Upišete:

  • naziv, opis i web — korisnik ih vidi pri prijavi;
  • vrstu: Ima server (dobivate client_secret, prikazuje se samo jednom) ili Mobilna / web bez servera (javni klijent, bez tajne, obavezan PKCE S256);
  • Redirect URI — točne adrese povratka; samo https (iznimka localhost), javni klijent smije i vlastitu shemu (com.primjer.app:/cb);
  • adresu za odjavu (po želji, https) — vidi „Odjava iz MojiAppa” niže;
  • verifikaciju: nije potrebna, dokument, ili dokument i lice;
  • podatke koje tražite, svaki obavezno ili po želji, uz svrhu i kontakt za zaštitu podataka.

Aplikacija smije tražiti samo scope koji odgovara odabranim podacima; openid i profile su uvijek dopušteni.

2. Adrese

For developers

“Sign in with MojiApp” is standard OAuth 2.0 / OpenID Connect (authorization code flow). Any OIDC library works.

1. Register your app

In MojiApp: Settings → Devices and access → My OAuth apps (for developers) → +. You enter:

  • name, description and website — users see them when signing in;
  • type: Has a server (you get a client_secret, shown only once) or Mobile / web without a server (public client, no secret, PKCE S256 required);
  • Redirect URIs — exact return addresses; https only (except localhost); a public client may also use its own scheme (com.example.app:/cb);
  • sign-out URL (optional, https) — see “Sign-out from MojiApp” below;
  • verification: none, document, or document and face;
  • data you request, each required or optional, with the purpose and a data-protection contact.

An app may request only the scopes matching the data it registered; openid and profile are always allowed.

2. Endpoints

Issuerhttps://mojiapp.eu
Discovery/api/oauth/.well-known/openid-configuration
AuthorizeGET /api/oauth/authorize
TokenPOST /api/oauth/token (form-encoded; client_secret_basic, client_secret_post ilior none + PKCE)
UserInfoGET /api/oauth/userinfo (Bearer)
JWKS/api/oauth/.well-known/jwks.json (RS256)
RevokePOST /api/oauth/revoke

3. Tok

  1. Preusmjerite korisnika na /api/oauth/authorize s response_type=code, client_id, redirect_uri, scope, state, nonce i (javni klijent obavezno) code_challenge + code_challenge_method=S256.
  2. MojiApp pokaže stranicu s QR kodom; korisnik potvrdi u aplikaciji, a preglednik se vrati na redirect_uri?code=…&state=…. Ako odbije: error=access_denied.
  3. Provjerite state, pa kod zamijenite za token na /api/oauth/token (kod vrijedi jednom).
  4. Dobivate access_token (1 sat) i id_token. Provjerite potpis id_tokena ključem iz JWKS-a, aud = vaš client_id, iss i nonce.
  5. Podatke čitajte iz id_tokena ili s /api/oauth/userinfo. Kad korisnik povuče pristanak, userinfo vraća 401.

Refresh token se ne izdaje — kad sesija istekne, korisnik se prijavi ponovno (jedan dodir u aplikaciji).

4. Odjava iz MojiAppa (Back-Channel Logout)

Korisnik se može odjaviti iz vaše aplikacije u MojiAppu. Ako ste registrirali adresu za odjavu, MojiApp na nju pošalje POST (form-encoded) s parametrom logout_token — JWT potpisan istim ključem (RS256, JWKS) prema OpenID Connect Back-Channel Logout 1.0:

  • provjerite potpis, iss, aud = vaš client_id i da events sadrži http://schemas.openid.net/event/backchannel-logout;
  • po sub završite sve sesije tog korisnika i odgovorite 200;
  • token nema nonce i vrijedi 2 minute; jti je jedinstven, pa ponovljeni možete odbiti.

Bez adrese za odjavu MojiApp povuče tokene i privolu (userinfo vraća 401), ali vaša vlastita sesija ostaje — korisnik dobiva savjet da se odjavi i na stranici.

3. Flow

  1. Redirect the user to /api/oauth/authorize with response_type=code, client_id, redirect_uri, scope, state, nonce and (required for public clients) code_challenge + code_challenge_method=S256.
  2. MojiApp shows a QR page; the user approves in the app and the browser returns to redirect_uri?code=…&state=…. On refusal: error=access_denied.
  3. Check state, then exchange the code at /api/oauth/token (single use).
  4. You receive an access_token (1 hour) and an id_token. Verify the id_token signature with the JWKS key, aud = your client_id, iss and nonce.
  5. Read the data from the id_token or /api/oauth/userinfo. Once the user withdraws consent, userinfo returns 401.

No refresh token is issued — when the session ends, the user signs in again (one tap in the app).

4. Sign-out from MojiApp (Back-Channel Logout)

Users can sign out of your app from inside MojiApp. If you registered a sign-out URL, MojiApp sends it a form-encoded POST with a logout_token — a JWT signed with the same key (RS256, JWKS) per OpenID Connect Back-Channel Logout 1.0:

  • verify the signature, iss, aud = your client_id, and that events contains http://schemas.openid.net/event/backchannel-logout;
  • end all sessions for that sub and respond 200;
  • the token has no nonce and is valid for 2 minutes; jti is unique, so you can reject replays.

Without a sign-out URL MojiApp revokes the tokens and the consent (userinfo returns 401), but your own session stays — the user is advised to sign out on the site too.

// PKCE (preglednik / browser)
const verifier = b64url(crypto.getRandomValues(new Uint8Array(32)));
const challenge = b64url(new Uint8Array(
  await crypto.subtle.digest('SHA-256', new TextEncoder().encode(verifier))));

location.href = 'https://mojiapp.eu/api/oauth/authorize?' + new URLSearchParams({
  response_type: 'code', client_id: CLIENT_ID, redirect_uri: REDIRECT_URI,
  scope: 'openid profile email', state, nonce,
  code_challenge: challenge, code_challenge_method: 'S256',
});

// redirect_uri?code=… → token
const r = await fetch('https://mojiapp.eu/api/oauth/token', {
  method: 'POST',
  headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
  body: new URLSearchParams({ grant_type: 'authorization_code', code,
    redirect_uri: REDIRECT_URI, client_id: CLIENT_ID, code_verifier: verifier }),
});
const { access_token, id_token } = await r.json();

Scope i podaciScopes and data

ScopeClaimsNapomenaNotes
openidsub, mojiapp_verification sub je različit za svaku aplikaciju i svaki profil korisnika. mojiapp_verification: 0 nije verificiran, 1 dokument, 2 dokument i lice. sub differs per app and per user profile. mojiapp_verification: 0 not verified, 1 document, 2 document and face.
profilenickname, preferred_username
name, given_name, family_name
Ime odabranog profila uvijek. Ime i prezime s dokumenta samo ako aplikacija traži podatak „Ime i prezime” i korisnik je verificiran. The chosen profile’s name, always. Full name from the document only if the app requests “Full name” and the user is verified.
emailemailKorisnik ga upiše pri pristanku.Entered by the user when consenting.
phonephone_numberKorisnik ga upiše pri pristanku.Entered by the user when consenting.
addressaddressformatted, locality, region, country — korisnik bira svoju adresu.formatted, locality, region, country — the user picks one of their addresses.
birthdatebirthdateS dokumenta — samo verificirani.From the document — verified users only.
age_over_18age_over_18Samo da/ne, bez datuma rođenja — samo verificirani.Yes/no only, no date of birth — verified users only.
— (pravilo aplikacije)— (app rule)age_over_13 … age_over_16, age_over_18Najmanja dob (13, 14, 15, 16 ili 18) postavlja se pri registraciji aplikacije, ne u scopeu. Mlađima se prijava odbija, a aplikacija uvijek dobiva samo age_over_N: true za svoju razinu, bez datuma rođenja — samo verificirani.The minimum age (13, 14, 15, 16 or 18) is set when registering the app, not in the scope. Younger users are refused, and the app always receives only age_over_N: true for its level, without the date of birth — verified users only.
oiboibHrvatski OIB s dokumenta — samo verificirani.Croatian national ID number from the document — verified users only.

Podatak koji je „po želji” korisnik smije ne dati — tada ga u odgovoru nema. Ako se pravila aplikacije promijene, korisnik pri sljedećoj prijavi ponovno pristaje. An optional item may be withheld — it is then simply missing from the response. If the app’s rules change, the user consents again at the next sign-in.

IsprobajTry it

Ova stranica glumi vašu aplikaciju. Upišite naziv i učitajte logo — vidjet ćete ih na stranici s QR kodom i u MojiAppu, točno kako će ih vidjeti vaši korisnici. This page acts as your app. Enter a name and upload a logo — you will see them on the QR page and in MojiApp, exactly as your users will.

AplikacijaApp

IzgledAppearance

MojiApp — testna prijava ovako će izgledati pri prijavithis is how it will look at sign-in
Korisnik uz testnu prijavu uvijek vidi oznaku „Testna aplikacija — naziv i logo nisu provjereni”. Naziv i logo vrijede samo za ovu jednu prijavu (15 minuta). U pravoj, registriranoj aplikaciji te oznake nema. Users always see “Test app — the name and logo are not verified” on a test sign-in. The name and logo apply to this one sign-in only (15 minutes). A real, registered app has no such label.

Što aplikacija tražiWhat the app requests

Najmanja dobMinimum age

Detalji za razvojDeveloper details