[{"data":1,"prerenderedAt":717},["ShallowReactive",2],{"navigation_docs":3,"-concepts-sessions-and-tokens":189,"-concepts-sessions-and-tokens-surround":712},[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":41,"body":191,"description":705,"extension":706,"links":707,"meta":708,"navigation":709,"path":42,"seo":710,"stem":43,"__hash__":711},"docs/2.concepts/2.sessions-and-tokens.md",{"type":192,"value":193,"toc":697},"minimark",[194,199,203,290,300,303,323,326,329,449,455,459,556,611,614,620,624,637,650,675,679,683,693],[195,196,198],"h2",{"id":197},"authsession","AuthSession",[200,201,202],"p",{},"One signed-in identity on the device.",[204,205,206,219],"table",{},[207,208,209],"thead",{},[210,211,212,216],"tr",{},[213,214,215],"th",{},"Field",[213,217,218],{},"Meaning",[220,221,222,238,252,266,276],"tbody",{},[210,223,224,231],{},[225,226,227],"td",{},[228,229,230],"code",{},"key",[225,232,233,234,237],{},"A ",[228,235,236],{},"SessionKey",": the provider id plus the user id within that provider.",[210,239,240,245],{},[225,241,242],{},[228,243,244],{},"user",[225,246,247,248,251],{},"An ",[228,249,250],{},"AuthUser",".",[210,253,254,259],{},[225,255,256],{},[228,257,258],{},"tokens",[225,260,261,262,265],{},"The application tokens, or ",[228,263,264],{},"null"," for an identity-only session.",[210,267,268,273],{},[225,269,270],{},[228,271,272],{},"providerData",[225,274,275],{},"Provider data that is not a session token, JSON-encodable.",[210,277,278,287],{},[225,279,280,283,284],{},[228,281,282],{},"createdAt",", ",[228,285,286],{},"lastUsedAt",[225,288,289],{},"When the session was created on this device, and last signed in to or switched to.",[200,291,292,293,296,297,251],{},"Read the active session with ",[228,294,295],{},"authyra.currentSession"," and all of them, most recently used first, with ",[228,298,299],{},"authyra.sessions",[195,301,236],{"id":302},"sessionkey",[200,304,305,308,309,312,313,316,317,319,320,322],{},[228,306,307],{},"SessionKey('api', '42')"," identifies the user ",[228,310,311],{},"42"," of the provider ",[228,314,315],{},"api",". User ids are only unique within one provider: ",[228,318,311],{}," in your API and ",[228,321,311],{}," in an OAuth server are different people. Signing in again with the same key updates the existing session instead of adding a duplicate.",[200,324,325],{},"Keep provider ids stable across releases: persisted sessions refer to them.",[195,327,250],{"id":328},"authuser",[330,331,336],"pre",{"className":332,"code":333,"language":334,"meta":335,"style":335},"language-dart shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","const AuthUser({\n  required String id,\n  String? email,\n  String? name,\n  String? avatarUrl,\n  Map\u003CString, Object?> claims = const {},\n});\n","dart","",[228,337,338,355,371,385,397,409,440],{"__ignoreMap":335},[339,340,343,347,351],"span",{"class":341,"line":342},"line",1,[339,344,346],{"class":345},"spNyl","const",[339,348,350],{"class":349},"sBMFI"," AuthUser",[339,352,354],{"class":353},"sTEyZ","({\n",[339,356,358,361,364,367],{"class":341,"line":357},2,[339,359,360],{"class":345},"  required",[339,362,363],{"class":349}," String",[339,365,366],{"class":353}," id",[339,368,370],{"class":369},"sMK4o",",\n",[339,372,374,377,380,383],{"class":341,"line":373},3,[339,375,376],{"class":349},"  String",[339,378,379],{"class":369},"?",[339,381,382],{"class":353}," email",[339,384,370],{"class":369},[339,386,388,390,392,395],{"class":341,"line":387},4,[339,389,376],{"class":349},[339,391,379],{"class":369},[339,393,394],{"class":353}," name",[339,396,370],{"class":369},[339,398,400,402,404,407],{"class":341,"line":399},5,[339,401,376],{"class":349},[339,403,379],{"class":369},[339,405,406],{"class":353}," avatarUrl",[339,408,370],{"class":369},[339,410,412,415,418,421,423,426,429,432,435,438],{"class":341,"line":411},6,[339,413,414],{"class":349},"  Map",[339,416,417],{"class":353},"\u003C",[339,419,420],{"class":349},"String",[339,422,283],{"class":353},[339,424,425],{"class":349},"Object",[339,427,428],{"class":353},"?> claims ",[339,430,431],{"class":369},"=",[339,433,434],{"class":345}," const",[339,436,437],{"class":353}," {}",[339,439,370],{"class":369},[339,441,443,446],{"class":341,"line":442},7,[339,444,445],{"class":353},"})",[339,447,448],{"class":369},";\n",[200,450,451,452,251],{},"Anything else your backend returns goes into ",[228,453,454],{},"claims",[195,456,458],{"id":457},"authtokens","AuthTokens",[330,460,462],{"className":332,"code":461,"language":334,"meta":335,"style":335},"AuthTokens.expiringIn(\n  Duration(seconds: json['expires_in'] as int),\n  accessToken: json['access_token'] as String,\n  refreshToken: json['refresh_token'] as String?,\n);\n",[228,463,464,477,509,529,550],{"__ignoreMap":335},[339,465,466,468,470,474],{"class":341,"line":342},[339,467,458],{"class":349},[339,469,251],{"class":369},[339,471,473],{"class":472},"s2Zo4","expiringIn",[339,475,476],{"class":353},"(\n",[339,478,479,482,485,488,491,495,498,501,504,507],{"class":341,"line":357},[339,480,481],{"class":349},"  Duration",[339,483,484],{"class":353},"(seconds",[339,486,487],{"class":369},":",[339,489,490],{"class":353}," json[",[339,492,494],{"class":493},"sfazB","'expires_in'",[339,496,497],{"class":353},"] ",[339,499,500],{"class":369},"as",[339,502,503],{"class":349}," int",[339,505,506],{"class":353},")",[339,508,370],{"class":369},[339,510,511,514,516,518,521,523,525,527],{"class":341,"line":373},[339,512,513],{"class":353},"  accessToken",[339,515,487],{"class":369},[339,517,490],{"class":353},[339,519,520],{"class":493},"'access_token'",[339,522,497],{"class":353},[339,524,500],{"class":369},[339,526,363],{"class":349},[339,528,370],{"class":369},[339,530,531,534,536,538,541,543,545,547],{"class":341,"line":387},[339,532,533],{"class":353},"  refreshToken",[339,535,487],{"class":369},[339,537,490],{"class":353},[339,539,540],{"class":493},"'refresh_token'",[339,542,497],{"class":353},[339,544,500],{"class":369},[339,546,363],{"class":349},[339,548,549],{"class":369},"?,\n",[339,551,552,554],{"class":341,"line":399},[339,553,506],{"class":353},[339,555,448],{"class":369},[204,557,558,566],{},[207,559,560],{},[210,561,562,564],{},[213,563,215],{},[213,565,218],{},[220,567,568,578,588,601],{},[210,569,570,575],{},[225,571,572],{},[228,573,574],{},"accessToken",[225,576,577],{},"The bearer token your API accepts.",[210,579,580,585],{},[225,581,582],{},[228,583,584],{},"refreshToken",[225,586,587],{},"Used to obtain new tokens. Without it, the session ends when the access token expires.",[210,589,590,595],{},[225,591,592],{},[228,593,594],{},"accessTokenExpiresAt",[225,596,597,598,600],{},"When the access token expires. Leave it ",[228,599,264],{}," if your backend does not say: Authyra then relies on 401 responses rather than guessing.",[210,602,603,608],{},[225,604,605],{},[228,606,607],{},"refreshTokenExpiresAt",[225,609,610],{},"When the refresh token expires, if your backend says. Authyra refreshes before that deadline to keep the session alive.",[200,612,613],{},"When a refresh response omits the refresh token, the current one is kept: backends that do not rotate refresh tokens work unchanged.",[200,615,616,619],{},[228,617,618],{},"toString()"," never prints token values.",[195,621,623],{"id":622},"session-tokens-not-identity-credentials","Session tokens, not identity credentials",[200,625,626,629,630,634,635,487],{},[228,627,628],{},"AuthSession.tokens"," holds ",[631,632,633],"strong",{},"application session tokens",": the ones your API accepts and can renew. A credential that only proves an identity and still needs exchanging belongs in ",[228,636,272],{},[638,639,640,644,647],"ul",{},[641,642,643],"li",{},"a Google ID token,",[641,645,646],{},"an Apple identity token or authorization code,",[641,648,649],{},"a GitHub access token your API does not accept.",[200,651,652,653,656,657,660,661,664,665,667,668,656,671,674],{},"The native providers follow this rule. ",[228,654,655],{},"GoogleProvider()"," and ",[228,658,659],{},"AppleProvider()"," return an ",[631,662,663],{},"identity-only"," session: no tokens, the credential in ",[228,666,272],{},", for example to hand to Firebase. ",[228,669,670],{},"GoogleProvider.withExchange",[228,672,673],{},"AppleProvider.withExchange"," send the credential to your backend, which returns your own tokens.",[676,677,678],"note",{},"Authyra never refreshes an identity provider's own tokens. Renewing them needs secrets that must stay on a server.",[195,680,682],{"id":681},"identity-only-sessions","Identity-only sessions",[200,684,685,686,689,690,692],{},"A session without tokens is valid: the user is signed in, and ",[228,687,688],{},"accessToken()"," returns ",[228,691,264],{},". It never expires on its own and is never refreshed; it ends when you sign out.",[694,695,696],"style",{},"html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}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 .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);}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}",{"title":335,"searchDepth":357,"depth":357,"links":698},[699,700,701,702,703,704],{"id":197,"depth":357,"text":198},{"id":302,"depth":357,"text":236},{"id":328,"depth":357,"text":250},{"id":457,"depth":357,"text":458},{"id":622,"depth":357,"text":623},{"id":681,"depth":357,"text":682},"AuthSession, SessionKey, AuthUser and AuthTokens, and the rule that keeps identity credentials out of session tokens.","md",null,{},{"icon":44},{"title":41,"description":705},"nx0-kCBzzKad7iswSTloFDVMNJzIr3tMjhQqAdunkUY",[713,715],{"title":36,"path":37,"stem":38,"description":714,"icon":39,"children":-1},"The roles of providers, Authyra, storage and your HTTP client, and what happens from sign-in to sign-out.",{"title":46,"path":47,"stem":48,"description":716,"icon":49,"children":-1},"The sealed AuthState your UI renders, the events that describe what happened to each session, and the errors Authyra throws.",1794303128106]