[{"data":1,"prerenderedAt":507},["ShallowReactive",2],{"navigation_docs":3,"-concepts-how-it-works":189,"-concepts-how-it-works-surround":502},[4,30,65,105,120,135,164,184],{"title":5,"icon":6,"path":7,"stem":8,"children":9,"page":6},"Getting started",false,"/getting-started","1.getting-started",[10,15,20,25],{"title":11,"path":12,"stem":13,"icon":14},"Introduction","/getting-started/introduction","1.getting-started/1.introduction","i-lucide-book-open",{"title":16,"path":17,"stem":18,"icon":19},"Installation","/getting-started/installation","1.getting-started/2.installation","i-lucide-download",{"title":21,"path":22,"stem":23,"icon":24},"Quick start","/getting-started/quick-start","1.getting-started/3.quick-start","i-lucide-rocket",{"title":26,"path":27,"stem":28,"icon":29},"Session Lab","/getting-started/session-lab","1.getting-started/4.session-lab","i-lucide-flask-conical",{"title":31,"icon":6,"path":32,"stem":33,"children":34,"page":6},"Concepts","/concepts","2.concepts",[35,40,45,50,55,60],{"title":36,"path":37,"stem":38,"icon":39},"How it works","/concepts/how-it-works","2.concepts/1.how-it-works","i-lucide-workflow",{"title":41,"path":42,"stem":43,"icon":44},"Sessions and tokens","/concepts/sessions-and-tokens","2.concepts/2.sessions-and-tokens","i-lucide-key-round",{"title":46,"path":47,"stem":48,"icon":49},"State and events","/concepts/state-and-events","2.concepts/3.state-and-events","i-lucide-radio",{"title":51,"path":52,"stem":53,"icon":54},"Token refresh","/concepts/token-refresh","2.concepts/4.token-refresh","i-lucide-refresh-cw",{"title":56,"path":57,"stem":58,"icon":59},"Storage","/concepts/storage","2.concepts/5.storage","i-lucide-hard-drive",{"title":61,"path":62,"stem":63,"icon":64},"Guarantees","/concepts/guarantees","2.concepts/6.guarantees","i-lucide-shield-check",{"title":66,"icon":6,"path":67,"stem":68,"children":69,"page":6},"Providers","/providers","3.providers",[70,75,80,85,90,95,100],{"title":71,"path":72,"stem":73,"icon":74},"Choosing a provider","/providers/choosing","3.providers/1.choosing","i-lucide-signpost",{"title":76,"path":77,"stem":78,"icon":79},"Credentials","/providers/credentials","3.providers/2.credentials","i-lucide-user-round-key",{"title":81,"path":82,"stem":83,"icon":84},"OAuth 2.0 and OpenID Connect","/providers/oauth2","3.providers/3.oauth2","i-lucide-shield",{"title":86,"path":87,"stem":88,"icon":89},"OAuth through your backend","/providers/backend-oauth","3.providers/4.backend-oauth","i-lucide-server",{"title":91,"path":92,"stem":93,"icon":94},"Google","/providers/google","3.providers/5.google","i-simple-icons-google",{"title":96,"path":97,"stem":98,"icon":99},"Apple","/providers/apple","3.providers/6.apple","i-simple-icons-apple",{"title":101,"path":102,"stem":103,"icon":104},"Custom providers","/providers/custom","3.providers/7.custom","i-lucide-puzzle",{"title":106,"icon":6,"path":107,"stem":108,"children":109,"page":6},"Flutter","/flutter","4.flutter",[110,115],{"title":111,"path":112,"stem":113,"icon":114},"Widgets","/flutter/widgets","4.flutter/1.widgets","i-lucide-layout-template",{"title":116,"path":117,"stem":118,"icon":119},"Routing","/flutter/routing","4.flutter/2.routing","i-lucide-route",{"title":121,"icon":6,"path":122,"stem":123,"children":124,"page":6},"HTTP","/http","5.http",[125,130],{"title":126,"path":127,"stem":128,"icon":129},"Dio","/http/dio","5.http/1.dio","i-lucide-arrow-left-right",{"title":131,"path":132,"stem":133,"icon":134},"Other HTTP clients","/http/other-clients","5.http/2.other-clients","i-lucide-plug-zap",{"title":136,"icon":6,"path":137,"stem":138,"children":139,"page":6},"Guides","/guides","6.guides",[140,145,150,155,159],{"title":141,"path":142,"stem":143,"icon":144},"Multiple accounts","/guides/multi-account","6.guides/1.multi-account","i-lucide-users",{"title":146,"path":147,"stem":148,"icon":149},"Sign-out and revocation","/guides/sign-out","6.guides/2.sign-out","i-lucide-log-out",{"title":151,"path":152,"stem":153,"icon":154},"Access policy","/guides/access-policy","6.guides/3.access-policy","i-lucide-shield-alert",{"title":156,"path":157,"stem":158,"icon":29},"Testing","/guides/testing","6.guides/4.testing",{"title":160,"path":161,"stem":162,"icon":163},"Backend requirements","/guides/backend-requirements","6.guides/5.backend-requirements","i-lucide-server-cog",{"title":165,"icon":6,"path":166,"stem":167,"children":168,"page":6},"Reference","/reference","7.reference",[169,174,179],{"title":170,"path":171,"stem":172,"icon":173},"API reference","/reference/api","7.reference/1.api","i-lucide-library",{"title":175,"path":176,"stem":177,"icon":178},"FAQ","/reference/faq","7.reference/2.faq","i-lucide-message-circle-question",{"title":180,"path":181,"stem":182,"icon":183},"Troubleshooting","/reference/troubleshooting","7.reference/3.troubleshooting","i-lucide-wrench",{"title":185,"path":186,"stem":187,"icon":188},"Changelog","/changelog","changelog","i-lucide-history",{"id":190,"title":36,"body":191,"description":495,"extension":496,"links":497,"meta":498,"navigation":499,"path":37,"seo":500,"stem":38,"__hash__":501},"docs/2.concepts/1.how-it-works.md",{"type":192,"value":193,"toc":490},"minimark",[194,199,210,293,297,301,390,394,407,480,486],[195,196,198],"h2",{"id":197},"four-roles","Four roles",[200,201,207],"pre",{"className":202,"code":204,"language":205,"meta":206},[203],"language-text","  Your UI ──── reads ────▶ AuthState (AuthUnknown | AuthSignedIn | AuthSignedOut)\n     │                          ▲\n     │ signIn / signOut         │ publishes\n     ▼                          │\n  Authyra ── owns ──▶ sessions, refresh scheduling, multi-account, events\n     │        │\n     │        └── persists ──▶ AuthStorage (platform keystore)\n     │\n     └── asks ──▶ AuthProvider (your API, OAuth server, Google, Apple...)\n\n  Your HTTP client ── accessToken() ──▶ Authyra\n","text","",[208,209,204],"code",{"__ignoreMap":206},[211,212,213,229],"table",{},[214,215,216],"thead",{},[217,218,219,223,226],"tr",{},[220,221,222],"th",{},"Role",[220,224,225],{},"Responsibility",[220,227,228],{},"Holds state?",[230,231,232,247,260,276],"tbody",{},[217,233,234,241,244],{},[235,236,237],"td",{},[238,239,240],"strong",{},"Provider",[235,242,243],{},"Authenticates the user, renews tokens, revokes them on sign-out.",[235,245,246],{},"No. It returns results; it never stores a session.",[217,248,249,254,257],{},[235,250,251],{},[238,252,253],{},"Authyra",[235,255,256],{},"Builds the session, persists it, refreshes it, ends it, publishes the state.",[235,258,259],{},"Yes, the single owner of every session.",[217,261,262,266,269],{},[235,263,264],{},[238,265,56],{},[235,267,268],{},"Keeps sessions across restarts.",[235,270,271,272,275],{},"Only strings under ",[208,273,274],{},"authyra.*"," keys.",[217,277,278,283,286],{},[235,279,280],{},[238,281,282],{},"HTTP client",[235,284,285],{},"Asks for a token before each request, reports a 401.",[235,287,288,289,292],{},"No. ",[208,290,291],{},"authyra_dio"," does this for Dio.",[294,295,296],"p",{},"Because providers are stateless, you can change how users sign in without touching how sessions behave, and test each side on its own.",[195,298,300],{"id":299},"the-life-of-a-session","The life of a session",[302,303,304,327,337,343,353,371,380],"ol",{},[305,306,307,310,311,314,315,318,319,322,323,326],"li",{},[238,308,309],{},"Sign-in."," ",[208,312,313],{},"authyra.signIn('api', params: ...)"," calls the provider, which returns an ",[208,316,317],{},"AuthSignInResult",": the user, the tokens, and optional provider data. Authyra builds an ",[208,320,321],{},"AuthSession",", persists it, makes it active and emits ",[208,324,325],{},"AuthSignedIn",".",[305,328,329,332,333,336],{},[238,330,331],{},"Use."," Your HTTP client calls ",[208,334,335],{},"authyra.accessToken()"," before each request. A valid token is returned at once; a token about to expire is refreshed first.",[305,338,339,342],{},[238,340,341],{},"Proactive refresh."," While the app runs, the active session is refreshed shortly before its access token expires (60 seconds by default), so requests rarely wait.",[305,344,345,348,349,352],{},[238,346,347],{},"Recovery."," When your API answers 401 anyway, the client asks for a new token with ",[208,350,351],{},"rejectedToken",". If another caller already refreshed, the new token is returned without a second refresh.",[305,354,355,358,359,362,363,366,367,370],{},[238,356,357],{},"Failures."," A refresh that fails for a transient reason (network, timeout, 5xx) keeps the session and is retried with backoff. A refresh token the server rejects ends the session: Authyra emits ",[208,360,361],{},"SessionEndedEvent"," with ",[208,364,365],{},"SessionEndReason.revoked",", and the state becomes ",[208,368,369],{},"AuthSignedOut"," if no other account remains.",[305,372,373,310,376,379],{},[238,374,375],{},"Sign-out.",[208,377,378],{},"authyra.signOut()"," blocks new refreshes, waits for one in flight, asks the provider to revoke the latest tokens server-side, then removes the session.",[305,381,382,385,386,389],{},[238,383,384],{},"Restart."," At the next launch, ",[208,387,388],{},"start()"," restores every session. A session whose access token expired while the app was closed is refreshed; one that can no longer be renewed is discarded.",[195,391,393],{"id":392},"one-instance-or-several","One instance, or several",[294,395,396,399,400,403,404,406],{},[208,397,398],{},"Authyra.initialize(...)"," creates an app-wide instance reachable through ",[208,401,402],{},"Authyra.instance",". When you inject dependencies yourself, create one with the constructor and call ",[208,405,388],{},":",[200,408,412],{"className":409,"code":410,"language":411,"meta":206,"style":206},"language-dart shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","final authyra = Authyra(storage: SecureAuthStorage(), providers: [apiProvider]);\nawait authyra.start();\n","dart",[208,413,414,460],{"__ignoreMap":206},[415,416,419,423,427,431,435,438,440,443,446,449,452,454,457],"span",{"class":417,"line":418},"line",1,[415,420,422],{"class":421},"spNyl","final",[415,424,426],{"class":425},"sTEyZ"," authyra ",[415,428,430],{"class":429},"sMK4o","=",[415,432,434],{"class":433},"sBMFI"," Authyra",[415,436,437],{"class":425},"(storage",[415,439,406],{"class":429},[415,441,442],{"class":433}," SecureAuthStorage",[415,444,445],{"class":425},"()",[415,447,448],{"class":429},",",[415,450,451],{"class":425}," providers",[415,453,406],{"class":429},[415,455,456],{"class":425}," [apiProvider])",[415,458,459],{"class":429},";\n",[415,461,463,467,470,472,476,478],{"class":417,"line":462},2,[415,464,466],{"class":465},"s7zQu","await",[415,468,469],{"class":425}," authyra",[415,471,326],{"class":429},[415,473,475],{"class":474},"s2Zo4","start",[415,477,445],{"class":425},[415,479,459],{"class":429},[294,481,482,485],{},[208,483,484],{},"dispose()"," stops background work and waits for writes in progress. Sessions stay persisted.",[487,488,489],"style",{},"html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":206,"searchDepth":462,"depth":462,"links":491},[492,493,494],{"id":197,"depth":462,"text":198},{"id":299,"depth":462,"text":300},{"id":392,"depth":462,"text":393},"The roles of providers, Authyra, storage and your HTTP client, and what happens from sign-in to sign-out.","md",null,{},{"icon":39},{"title":36,"description":495},"_nTq1vCs85Eg6J2VafcdBjtxAp0blR1OltyB29Kmmt0",[503,505],{"title":26,"path":27,"stem":28,"description":504,"icon":29,"children":-1},"An interactive demo that runs the real Authyra against a fake, strict auth server in your browser.",{"title":41,"path":42,"stem":43,"description":506,"icon":44,"children":-1},"AuthSession, SessionKey, AuthUser and AuthTokens, and the rule that keeps identity credentials out of session tokens.",1794303128106]