[{"data":1,"prerenderedAt":651},["ShallowReactive",2],{"i-lucide:chevron-down":3,"i-lucide:arrow-up-right":8,"i-simple-icons:github":10,"i-simple-icons:x":12,"i-brand:linkedin":14,"i-simple-icons:medium":18,"i-lucide:mail":20,"i-lucide:sun":22,"article:\u002Farticles\u002Flaravel\u002Fsetting_up_authentication_for_laravel_single_page_applications":24,"article-more:\u002Farticles\u002Flaravel\u002Fsetting_up_authentication_for_laravel_single_page_applications":634,"i-simple-icons:javascript":645,"i-lucide:copy":647,"i-lucide:info":649},{"left":4,"top":4,"width":5,"height":5,"rotate":4,"vFlip":6,"hFlip":6,"body":7},0,24,false,"\u003Cpath fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"m6 9l6 6l6-6\"\u002F>",{"left":4,"top":4,"width":5,"height":5,"rotate":4,"vFlip":6,"hFlip":6,"body":9},"\u003Cpath fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M7 7h10v10M7 17L17 7\"\u002F>",{"left":4,"top":4,"width":5,"height":5,"rotate":4,"vFlip":6,"hFlip":6,"body":11},"\u003Cpath fill=\"currentColor\" d=\"M12 .297c-6.63 0-12 5.373-12 12c0 5.303 3.438 9.8 8.205 11.385c.6.113.82-.258.82-.577c0-.285-.01-1.04-.015-2.04c-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729c1.205.084 1.838 1.236 1.838 1.236c1.07 1.835 2.809 1.305 3.495.998c.108-.776.417-1.305.76-1.605c-2.665-.3-5.466-1.332-5.466-5.93c0-1.31.465-2.38 1.235-3.22c-.135-.303-.54-1.523.105-3.176c0 0 1.005-.322 3.3 1.23c.96-.267 1.98-.399 3-.405c1.02.006 2.04.138 3 .405c2.28-1.552 3.285-1.23 3.285-1.23c.645 1.653.24 2.873.12 3.176c.765.84 1.23 1.91 1.23 3.22c0 4.61-2.805 5.625-5.475 5.92c.42.36.81 1.096.81 2.22c0 1.606-.015 2.896-.015 3.286c0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12\"\u002F>",{"left":4,"top":4,"width":5,"height":5,"rotate":4,"vFlip":6,"hFlip":6,"body":13},"\u003Cpath fill=\"currentColor\" d=\"M14.234 10.162L22.977 0h-2.072l-7.591 8.824L7.251 0H.258l9.168 13.343L.258 24H2.33l8.016-9.318L16.749 24h6.993zm-2.837 3.299l-.929-1.329L3.076 1.56h3.182l5.965 8.532l.929 1.329l7.754 11.09h-3.182z\"\u002F>",{"left":4,"top":15,"width":16,"height":16,"rotate":4,"vFlip":6,"hFlip":6,"body":17},32,448,"\u003Cpath fill=\"currentColor\" d=\"M416 32L31.9 32C14.3 32 0 46.5 0 64.3L0 447.7C0 465.5 14.3 480 31.9 480L416 480c17.6 0 32-14.5 32-32.3l0-383.4C448 46.5 433.6 32 416 32zM135.4 416l-66.4 0 0-213.8 66.5 0 0 213.8-.1 0zM102.2 96a38.5 38.5 0 1 1 0 77 38.5 38.5 0 1 1 0-77zM384.3 416l-66.4 0 0-104c0-24.8-.5-56.7-34.5-56.7-34.6 0-39.9 27-39.9 54.9l0 105.8-66.4 0 0-213.8 63.7 0 0 29.2 .9 0c8.9-16.8 30.6-34.5 62.9-34.5 67.2 0 79.7 44.3 79.7 101.9l0 117.2z\"\u002F>",{"left":4,"top":4,"width":5,"height":5,"rotate":4,"vFlip":6,"hFlip":6,"body":19},"\u003Cpath fill=\"currentColor\" d=\"M4.21 0A4.2 4.2 0 0 0 0 4.21v15.58A4.2 4.2 0 0 0 4.21 24h15.58A4.2 4.2 0 0 0 24 19.79v-1.093a5 5 0 0 1-.422.02c-2.577 0-4.027-2.146-4.09-4.832a8 8 0 0 1 .022-.708c.093-1.186.475-2.241 1.105-3.022a3.9 3.9 0 0 1 1.395-1.1c.468-.237 1.127-.367 1.664-.367h.023q.151 0 .303.01V4.211A4.2 4.2 0 0 0 19.79 0Zm.198 5.583h4.165l3.588 8.435l3.59-8.435h3.864v.146l-.019.004c-.705.16-1.063.397-1.063 1.254h-.003l.003 10.274c.06.676.424.885 1.063 1.03l.02.004v.145h-4.923v-.145l.019-.005c.639-.144.994-.353 1.054-1.03V7.267l-4.745 11.15h-.261L6.15 7.569v9.445c0 .857.358 1.094 1.063 1.253l.02.004v.147H4.405v-.147l.019-.004c.705-.16 1.065-.397 1.065-1.253V6.987c0-.857-.358-1.094-1.064-1.254l-.018-.004zm19.25 3.668c-1.086.023-1.733 1.323-1.813 3.124H24V9.298a1.4 1.4 0 0 0-.342-.047m-1.862 3.632c-.1 1.756.86 3.239 2.204 3.634v-3.634z\"\u002F>",{"left":4,"top":4,"width":5,"height":5,"rotate":4,"vFlip":6,"hFlip":6,"body":21},"\u003Cg fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\">\u003Cpath d=\"m22 7l-8.991 5.727a2 2 0 0 1-2.009 0L2 7\"\u002F>\u003Crect width=\"20\" height=\"16\" x=\"2\" y=\"4\" rx=\"2\"\u002F>\u003C\u002Fg>",{"left":4,"top":4,"width":5,"height":5,"rotate":4,"vFlip":6,"hFlip":6,"body":23},"\u003Cg fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\">\u003Ccircle cx=\"12\" cy=\"12\" r=\"4\"\u002F>\u003Cpath d=\"M12 2v2m0 16v2M4.93 4.93l1.41 1.41m11.32 11.32l1.41 1.41M2 12h2m16 0h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41\"\u002F>\u003C\u002Fg>",{"id":25,"title":26,"body":27,"category":621,"date":622,"description":623,"extension":624,"icon":625,"meta":626,"navigation":567,"path":627,"rawbody":628,"readingTime":629,"seo":630,"sitemap":631,"stem":632,"__hash__":633},"articles\u002Farticles\u002Flaravel\u002Fsetting_up_authentication_for_laravel_single_page_applications.md","Setting up authentication for Laravel single-page apps",{"type":28,"value":29,"toc":612},"minimark",[30,34,44,49,70,140,147,306,319,326,354,360,367,469,475,482,574,577,601,608],[31,32,33],"p",{},"Suppose you have two websites that require authentication:",[35,36,37,41],"ol",{},[38,39,40],"li",{},"localhost:8000 (backend)",[38,42,43],{},"localhost:3000 (frontend)",[45,46,48],"h3",{"id":47},"configuration-steps","Configuration Steps:",[35,50,51,58,64],{},[38,52,53,54],{},"Allow origins for ",[55,56,57],"code",{},"https:\u002F\u002Flocalhost:3000",[38,59,60,61],{},"Set the session domain to ",[55,62,63],{},"localhost",[38,65,66,67],{},"Configure Sanctum stateful domains for ",[55,68,69],{},"localhost:3000",[71,72,73,89],"table",{},[74,75,76],"thead",{},[77,78,79,83,86],"tr",{},[80,81,82],"th",{},"Setting",[80,84,85],{},"Value",[80,87,88],{},"Format",[90,91,92,112,126],"tbody",{},[77,93,94,98,102],{},[95,96,97],"td",{},"FRONTEND_URL",[95,99,100],{},[55,101,57],{},[95,103,104,107,108,111],{},[55,105,106],{},"scheme:\u002F\u002Fhost:port"," without ",[55,109,110],{},"\u002F"," at the end of the URL",[77,113,114,117,121],{},[95,115,116],{},"SESSION_DOMAIN",[95,118,119],{},[55,120,63],{},[95,122,123],{},[55,124,125],{},"host",[77,127,128,131,135],{},[95,129,130],{},"SANCTUM_STATEFUL_DOMAINS",[95,132,133],{},[55,134,69],{},[95,136,137],{},[55,138,139],{},"host:port",[45,141,143,144],{"id":142},"_1-update-configcorsphp","1. Update ",[55,145,146],{},"config\u002Fcors.php",[148,149,154],"pre",{"className":150,"code":151,"filename":146,"language":152,"meta":153,"style":153},"language-php shiki shiki-themes haytham-dark haytham-light","return [\n  'paths' => ['api\u002F*', 'sanctum\u002Fcsrf-cookie'],\n  'allowed_methods' => ['*'],\n  'allowed_origins' => [env('FRONTEND_URL', 'http:\u002F\u002F127.0.0.1:8000')],\n  'allowed_origins_patterns' => [],\n  'allowed_headers' => ['*'],\n  'exposed_headers' => [],\n  'max_age' => 0,\n  'supports_credentials' => true,\n];\n","php","",[55,155,156,169,194,209,237,248,262,272,287,300],{"__ignoreMap":153},[157,158,161,165],"span",{"class":159,"line":160},"line",1,[157,162,164],{"class":163},"sVsk0","return",[157,166,168],{"class":167},"sVG6I"," [\n",[157,170,172,176,179,182,185,188,191],{"class":159,"line":171},2,[157,173,175],{"class":174},"sUOzB","  'paths'",[157,177,178],{"class":167}," =>",[157,180,181],{"class":167}," [",[157,183,184],{"class":174},"'api\u002F*'",[157,186,187],{"class":167},",",[157,189,190],{"class":174}," 'sanctum\u002Fcsrf-cookie'",[157,192,193],{"class":167},"],\n",[157,195,197,200,202,204,207],{"class":159,"line":196},3,[157,198,199],{"class":174},"  'allowed_methods'",[157,201,178],{"class":167},[157,203,181],{"class":167},[157,205,206],{"class":174},"'*'",[157,208,193],{"class":167},[157,210,212,215,217,219,223,226,229,231,234],{"class":159,"line":211},4,[157,213,214],{"class":174},"  'allowed_origins'",[157,216,178],{"class":167},[157,218,181],{"class":167},[157,220,222],{"class":221},"sVz7n","env",[157,224,225],{"class":167},"(",[157,227,228],{"class":174},"'FRONTEND_URL'",[157,230,187],{"class":167},[157,232,233],{"class":174}," 'http:\u002F\u002F127.0.0.1:8000'",[157,235,236],{"class":167},")],\n",[157,238,240,243,245],{"class":159,"line":239},5,[157,241,242],{"class":174},"  'allowed_origins_patterns'",[157,244,178],{"class":167},[157,246,247],{"class":167}," [],\n",[157,249,251,254,256,258,260],{"class":159,"line":250},6,[157,252,253],{"class":174},"  'allowed_headers'",[157,255,178],{"class":167},[157,257,181],{"class":167},[157,259,206],{"class":174},[157,261,193],{"class":167},[157,263,265,268,270],{"class":159,"line":264},7,[157,266,267],{"class":174},"  'exposed_headers'",[157,269,178],{"class":167},[157,271,247],{"class":167},[157,273,275,278,280,284],{"class":159,"line":274},8,[157,276,277],{"class":174},"  'max_age'",[157,279,178],{"class":167},[157,281,283],{"class":282},"sheII"," 0",[157,285,286],{"class":167},",\n",[157,288,290,293,295,298],{"class":159,"line":289},9,[157,291,292],{"class":174},"  'supports_credentials'",[157,294,178],{"class":167},[157,296,297],{"class":282}," true",[157,299,286],{"class":167},[157,301,303],{"class":159,"line":302},10,[157,304,305],{"class":167},"];\n",[31,307,308,309,311,312,315,316,318],{},"In allowed_origins, add the ",[55,310,97],{}," in the format ",[55,313,314],{},"scheme:\u002F\u002Fhostname",", such as ",[55,317,57],{},".",[45,320,322,323],{"id":321},"_2-update-configsessionphp","2. Update ",[55,324,325],{},"config\u002Fsession.php",[148,327,329],{"className":150,"code":328,"filename":325,"language":152,"meta":153,"style":153},"'domain' => env('SESSION_DOMAIN', null),\n",[55,330,331],{"__ignoreMap":153},[157,332,333,336,338,341,343,346,348,351],{"class":159,"line":160},[157,334,335],{"class":174},"'domain'",[157,337,178],{"class":167},[157,339,340],{"class":221}," env",[157,342,225],{"class":167},[157,344,345],{"class":174},"'SESSION_DOMAIN'",[157,347,187],{"class":167},[157,349,350],{"class":282}," null",[157,352,353],{"class":167},"),\n",[31,355,356,357,359],{},"Set the ",[55,358,116],{}," to the main host, e.g., localhost.",[45,361,363,364],{"id":362},"_3-update-configsanctumphp","3. Update ",[55,365,366],{},"config\u002Fsanctum.php",[148,368,370],{"className":150,"code":369,"filename":366,"language":152,"meta":153,"style":153},"'stateful' => explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf(\n    '%s%s',\n    'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1',\n    env('APP_URL') ? ','.parse_url(env('APP_URL'), PHP_URL_HOST) : ''\n))),\n",[55,371,372,404,411,418,464],{"__ignoreMap":153},[157,373,374,377,379,382,384,387,389,391,393,396,398,401],{"class":159,"line":160},[157,375,376],{"class":174},"'stateful'",[157,378,178],{"class":167},[157,380,381],{"class":221}," explode",[157,383,225],{"class":167},[157,385,386],{"class":174},"','",[157,388,187],{"class":167},[157,390,340],{"class":221},[157,392,225],{"class":167},[157,394,395],{"class":174},"'SANCTUM_STATEFUL_DOMAINS'",[157,397,187],{"class":167},[157,399,400],{"class":221}," sprintf",[157,402,403],{"class":167},"(\n",[157,405,406,409],{"class":159,"line":171},[157,407,408],{"class":174},"    '%s%s'",[157,410,286],{"class":167},[157,412,413,416],{"class":159,"line":196},[157,414,415],{"class":174},"    'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1'",[157,417,286],{"class":167},[157,419,420,423,425,428,431,434,437,439,442,444,446,448,450,453,456,458,461],{"class":159,"line":211},[157,421,422],{"class":221},"    env",[157,424,225],{"class":167},[157,426,427],{"class":174},"'APP_URL'",[157,429,430],{"class":167},")",[157,432,433],{"class":167}," ?",[157,435,436],{"class":174}," ','",[157,438,318],{"class":167},[157,440,441],{"class":221},"parse_url",[157,443,225],{"class":167},[157,445,222],{"class":221},[157,447,225],{"class":167},[157,449,427],{"class":174},[157,451,452],{"class":167},"),",[157,454,455],{"class":282}," PHP_URL_HOST",[157,457,430],{"class":167},[157,459,460],{"class":167}," :",[157,462,463],{"class":174}," ''\n",[157,465,466],{"class":159,"line":239},[157,467,468],{"class":167},"))),\n",[31,470,471,472,474],{},"Add ",[55,473,130],{}," only for the main host, e.g., localhost.",[31,476,477,478,481],{},"Update the ",[55,479,480],{},".env"," file:",[148,483,487],{"className":484,"code":485,"filename":480,"language":486,"meta":153,"style":153},"language-dotenv shiki shiki-themes haytham-dark haytham-light","APP_NAME=\nAPP_ENV=local\nAPP_KEY=\nAPP_DEBUG=true\nAPP_URL=http:\u002F\u002Flocalhost:8000\nFRONTEND_URL=http:\u002F\u002Flocalhost:3000\nSESSION_DOMAIN=localhost\nSANCTUM_STATEFUL_DOMAINS=localhost:3000\n\n\u002F\u002F etc...\n","dotenv",[55,488,489,498,509,516,526,536,545,554,563,569],{"__ignoreMap":153},[157,490,491,495],{"class":159,"line":160},[157,492,494],{"class":493},"sWFPS","APP_NAME",[157,496,497],{"class":167},"=\n",[157,499,500,503,506],{"class":159,"line":171},[157,501,502],{"class":493},"APP_ENV",[157,504,505],{"class":167},"=",[157,507,508],{"class":493},"local\n",[157,510,511,514],{"class":159,"line":196},[157,512,513],{"class":493},"APP_KEY",[157,515,497],{"class":167},[157,517,518,521,523],{"class":159,"line":211},[157,519,520],{"class":493},"APP_DEBUG",[157,522,505],{"class":167},[157,524,525],{"class":493},"true\n",[157,527,528,531,533],{"class":159,"line":239},[157,529,530],{"class":493},"APP_URL",[157,532,505],{"class":167},[157,534,535],{"class":493},"http:\u002F\u002Flocalhost:8000\n",[157,537,538,540,542],{"class":159,"line":250},[157,539,97],{"class":493},[157,541,505],{"class":167},[157,543,544],{"class":493},"http:\u002F\u002Flocalhost:3000\n",[157,546,547,549,551],{"class":159,"line":264},[157,548,116],{"class":493},[157,550,505],{"class":167},[157,552,553],{"class":493},"localhost\n",[157,555,556,558,560],{"class":159,"line":274},[157,557,130],{"class":493},[157,559,505],{"class":167},[157,561,562],{"class":493},"localhost:3000\n",[157,564,565],{"class":159,"line":289},[157,566,568],{"emptyLinePlaceholder":567},true,"\n",[157,570,571],{"class":159,"line":302},[157,572,573],{"class":493},"\u002F\u002F etc...\n",[31,575,576],{},"Notes:",[35,578,579,594],{},[38,580,581,582,584,585,587,588,590,591,593],{},"The domain in ",[55,583,130],{}," must be part of the same domain as ",[55,586,116],{}," (e.g., ",[55,589,69],{}," -> ",[55,592,63],{},").",[38,595,596,597,600],{},"The default ",[55,598,599],{},"SESSION_LIFETIME"," is set to expire after 2 hours.",[602,603,605],"alert-info",{"to":604},"https:\u002F\u002Flaravel.com\u002Fdocs\u002F10.x\u002Fsanctum#spa-authentication",[31,606,607],{},"For more information, refer to the Laravel Sanctum SPA Authentication documentation",[609,610,611],"style",{},"html pre.shiki code .sVsk0, html code.shiki .sVsk0{--shiki-default:#9D9FFE;--shiki-light:#6762D3}html pre.shiki code .sVG6I, html code.shiki .sVG6I{--shiki-default:#85858F;--shiki-light:#71717A}html pre.shiki code .sUOzB, html code.shiki .sUOzB{--shiki-default:#9EC7FE;--shiki-light:#2873D1}html pre.shiki code .sVz7n, html code.shiki .sVz7n{--shiki-default:#EDEDEF;--shiki-light:#0B0B0C}html pre.shiki code .sheII, html code.shiki .sheII{--shiki-default:#70ADFF;--shiki-light:#195CAE}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 .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 pre.shiki code .sWFPS, html code.shiki .sWFPS{--shiki-default:#C4C4CC;--shiki-light:#3F3F46}",{"title":153,"searchDepth":171,"depth":171,"links":613},[614,615,617,619],{"id":47,"depth":196,"text":48},{"id":142,"depth":196,"text":616},"1. Update config\u002Fcors.php",{"id":321,"depth":196,"text":618},"2. Update config\u002Fsession.php",{"id":362,"depth":196,"text":620},"3. Update config\u002Fsanctum.php","Laravel","2022-10-11","The three settings (CORS origins, session domain and Sanctum stateful domains) that make a separate SPA front end log in cleanly.","md","simple-icons:laravel",{},"\u002Farticles\u002Flaravel\u002Fsetting_up_authentication_for_laravel_single_page_applications","---\ntitle: 'Setting up authentication for Laravel single-page apps'\ndescription: 'The three settings (CORS origins, session domain and Sanctum stateful domains) that make a separate SPA front end log in cleanly.'\ndate: '2022-10-11'\ncategory: 'Laravel'\nicon: 'simple-icons:laravel'\nreadingTime: '2 min read'\n---\n\nSuppose you have two websites that require authentication:\n\n1. localhost:8000 (backend)\n2. localhost:3000 (frontend)\n\n### Configuration Steps:\n\n1. Allow origins for `https:\u002F\u002Flocalhost:3000`\n2. Set the session domain to `localhost`\n3. Configure Sanctum stateful domains for `localhost:3000`\n\n| Setting                  | Value                    | Format                                                 |\n| ------------------------ | ------------------------ | ------------------------------------------------------ |\n| FRONTEND_URL             | `https:\u002F\u002Flocalhost:3000` | `scheme:\u002F\u002Fhost:port` without `\u002F` at the end of the URL |\n| SESSION_DOMAIN           | `localhost`              | `host`                                                 |\n| SANCTUM_STATEFUL_DOMAINS | `localhost:3000`         | `host:port`                                            |\n\n### 1. Update `config\u002Fcors.php`\n\n```php [config\u002Fcors.php]\nreturn [\n  'paths' => ['api\u002F*', 'sanctum\u002Fcsrf-cookie'],\n  'allowed_methods' => ['*'],\n  'allowed_origins' => [env('FRONTEND_URL', 'http:\u002F\u002F127.0.0.1:8000')],\n  'allowed_origins_patterns' => [],\n  'allowed_headers' => ['*'],\n  'exposed_headers' => [],\n  'max_age' => 0,\n  'supports_credentials' => true,\n];\n```\n\nIn allowed_origins, add the `FRONTEND_URL` in the format `scheme:\u002F\u002Fhostname`, such as `https:\u002F\u002Flocalhost:3000`.\n\n### 2. Update `config\u002Fsession.php`\n\n```php [config\u002Fsession.php]\n'domain' => env('SESSION_DOMAIN', null),\n```\n\nSet the `SESSION_DOMAIN` to the main host, e.g., localhost.\n\n### 3. Update `config\u002Fsanctum.php`\n\n```php [config\u002Fsanctum.php]\n'stateful' => explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf(\n    '%s%s',\n    'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1',\n    env('APP_URL') ? ','.parse_url(env('APP_URL'), PHP_URL_HOST) : ''\n))),\n```\n\nAdd `SANCTUM_STATEFUL_DOMAINS` only for the main host, e.g., localhost.\n\nUpdate the `.env` file:\n\n```dotenv [.env]\nAPP_NAME=\nAPP_ENV=local\nAPP_KEY=\nAPP_DEBUG=true\nAPP_URL=http:\u002F\u002Flocalhost:8000\nFRONTEND_URL=http:\u002F\u002Flocalhost:3000\nSESSION_DOMAIN=localhost\nSANCTUM_STATEFUL_DOMAINS=localhost:3000\n\n\u002F\u002F etc...\n```\n\nNotes:\n\n1. The domain in `SANCTUM_STATEFUL_DOMAINS` must be part of the same domain as `SESSION_DOMAIN` (e.g., `localhost:3000` -> `localhost`).\n\n2. The default `SESSION_LIFETIME` is set to expire after 2 hours.\n\n\n::alert-info{to=\"https:\u002F\u002Flaravel.com\u002Fdocs\u002F10.x\u002Fsanctum#spa-authentication\"}\nFor more information, refer to the Laravel Sanctum SPA Authentication documentation\n::\n","2 min read",{"title":26,"description":623},{"loc":627,"lastmod":622},"articles\u002Flaravel\u002Fsetting_up_authentication_for_laravel_single_page_applications","0UMtI--YEV2uqzU8JkH7_OKJq-jPwJOEByvYvCNhkvI",[635,640],{"path":636,"title":637,"date":638,"icon":639},"\u002Farticles\u002Fsoftware-engineering\u002Fhow_to_contribute_to_open_source_projects","How to contribute to open-source projects","2023-07-21","simple-icons:github",{"path":641,"title":642,"date":643,"icon":644},"\u002Farticles\u002Ffront-end\u002Fconfiguring-prettier-pre-commit-hook","Configuring a Prettier pre-commit hook","2023-01-16","simple-icons:javascript",{"left":4,"top":4,"width":5,"height":5,"rotate":4,"vFlip":6,"hFlip":6,"body":646},"\u003Cpath fill=\"currentColor\" d=\"M0 0h24v24H0zm22.034 18.276c-.175-1.095-.888-2.015-3.003-2.873c-.736-.345-1.554-.585-1.797-1.14c-.091-.33-.105-.51-.046-.705c.15-.646.915-.84 1.515-.66c.39.12.75.42.976.9c1.034-.676 1.034-.676 1.755-1.125c-.27-.42-.404-.601-.586-.78c-.63-.705-1.469-1.065-2.834-1.034l-.705.089c-.676.165-1.32.525-1.71 1.005c-1.14 1.291-.811 3.541.569 4.471c1.365 1.02 3.361 1.244 3.616 2.205c.24 1.17-.87 1.545-1.966 1.41c-.811-.18-1.26-.586-1.755-1.336l-1.83 1.051c.21.48.45.689.81 1.109c1.74 1.756 6.09 1.666 6.871-1.004c.029-.09.24-.705.074-1.65zm-8.983-7.245h-2.248c0 1.938-.009 3.864-.009 5.805c0 1.232.063 2.363-.138 2.711c-.33.689-1.18.601-1.566.48c-.396-.196-.597-.466-.83-.855c-.063-.105-.11-.196-.127-.196l-1.825 1.125c.305.63.75 1.172 1.324 1.517c.855.51 2.004.675 3.207.405c.783-.226 1.458-.691 1.811-1.411c.51-.93.402-2.07.397-3.346c.012-2.054 0-4.109 0-6.179z\"\u002F>",{"left":4,"top":4,"width":5,"height":5,"rotate":4,"vFlip":6,"hFlip":6,"body":648},"\u003Cg fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\">\u003Crect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\" ry=\"2\"\u002F>\u003Cpath d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\"\u002F>\u003C\u002Fg>",{"left":4,"top":4,"width":5,"height":5,"rotate":4,"vFlip":6,"hFlip":6,"body":650},"\u003Cg fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\">\u003Ccircle cx=\"12\" cy=\"12\" r=\"10\"\u002F>\u003Cpath d=\"M12 16v-4m0-4h.01\"\u002F>\u003C\u002Fg>",1792681039716]