[{"data":1,"prerenderedAt":809},["ShallowReactive",2],{"navigation_docs":3,"-guides-authentication":199,"-guides-authentication-surround":804},[4,23,65,87,133,159,177],{"title":5,"icon":6,"path":7,"stem":8,"children":9,"page":22},"Getting started","i-lucide-rocket","\u002Fgetting-started","1.getting-started",[10,14,18],{"title":11,"path":12,"stem":13},"Introduction","\u002Fgetting-started\u002Fintroduction","1.getting-started\u002F1.introduction",{"title":15,"path":16,"stem":17},"Installation","\u002Fgetting-started\u002Finstallation","1.getting-started\u002F2.installation",{"title":19,"path":20,"stem":21},"Quick start","\u002Fgetting-started\u002Fquick-start","1.getting-started\u002F3.quick-start",false,{"title":24,"icon":25,"path":26,"stem":27,"children":28,"page":22},"Guides","i-lucide-compass","\u002Fguides","2.guides",[29,33,37,41,45,49,53,57,61],{"title":30,"path":31,"stem":32},"Authenticate","\u002Fguides\u002Fauthentication","2.guides\u002F1.authentication",{"title":34,"path":35,"stem":36},"Work with several forges","\u002Fguides\u002Fmultiple-forges","2.guides\u002F2.multiple-forges",{"title":38,"path":39,"stem":40},"Configure from the environment","\u002Fguides\u002Fenvironment","2.guides\u002F3.environment",{"title":42,"path":43,"stem":44},"Receive webhooks","\u002Fguides\u002Fwebhooks","2.guides\u002F4.webhooks",{"title":46,"path":47,"stem":48},"Check what a forge supports","\u002Fguides\u002Fcapabilities","2.guides\u002F5.capabilities",{"title":50,"path":51,"stem":52},"Handle errors and rate limits","\u002Fguides\u002Ferrors","2.guides\u002F6.errors",{"title":54,"path":55,"stem":56},"Page through results","\u002Fguides\u002Fpagination","2.guides\u002F7.pagination",{"title":58,"path":59,"stem":60},"Browser bundles","\u002Fguides\u002Fbundling","2.guides\u002F8.bundling",{"title":62,"path":63,"stem":64},"Test your code","\u002Fguides\u002Ftesting","2.guides\u002F9.testing",{"title":66,"icon":67,"path":68,"stem":69,"children":70,"page":22},"Concepts","i-lucide-lightbulb","\u002Fconcepts","3.concepts",[71,75,79,83],{"title":72,"path":73,"stem":74},"Data model","\u002Fconcepts\u002Fdata-model","3.concepts\u002F1.data-model",{"title":76,"path":77,"stem":78},"Capabilities","\u002Fconcepts\u002Fcapabilities","3.concepts\u002F2.capabilities",{"title":80,"path":81,"stem":82},"Providers and factories","\u002Fconcepts\u002Fproviders","3.concepts\u002F3.providers",{"title":84,"path":85,"stem":86},"Events","\u002Fconcepts\u002Fevents","3.concepts\u002F4.events",{"title":88,"icon":89,"path":90,"stem":91,"children":92,"page":22},"Providers","i-lucide-server","\u002Fproviders","4.providers",[93,97,101,105,109,113,117,121,125,129],{"title":94,"path":95,"stem":96},"Azure DevOps","\u002Fproviders\u002Fazure-devops","4.providers\u002Fazure-devops",{"title":98,"path":99,"stem":100},"Bitbucket Cloud","\u002Fproviders\u002Fbitbucket","4.providers\u002Fbitbucket",{"title":102,"path":103,"stem":104},"Cursor Origin","\u002Fproviders\u002Fcursor-origin","4.providers\u002Fcursor-origin",{"title":106,"path":107,"stem":108},"Forgejo and Codeberg","\u002Fproviders\u002Fforgejo","4.providers\u002Fforgejo",{"title":110,"path":111,"stem":112},"Gitea","\u002Fproviders\u002Fgitea","4.providers\u002Fgitea",{"title":114,"path":115,"stem":116},"Gitee","\u002Fproviders\u002Fgitee","4.providers\u002Fgitee",{"title":118,"path":119,"stem":120},"GitHub","\u002Fproviders\u002Fgithub","4.providers\u002Fgithub",{"title":122,"path":123,"stem":124},"GitLab","\u002Fproviders\u002Fgitlab","4.providers\u002Fgitlab",{"title":126,"path":127,"stem":128},"pushin.eu","\u002Fproviders\u002Fpushin","4.providers\u002Fpushin",{"title":130,"path":131,"stem":132},"Tangled","\u002Fproviders\u002Ftangled","4.providers\u002Ftangled",{"title":134,"icon":135,"path":136,"stem":137,"children":138,"page":22},"Reference","i-lucide-book-marked","\u002Freference","5.reference",[139,143,147,151,155],{"title":140,"path":141,"stem":142},"Provider API","\u002Freference\u002Fprovider-api","5.reference\u002F1.provider-api",{"title":144,"path":145,"stem":146},"Capability matrix","\u002Freference\u002Fcapability-matrix","5.reference\u002F2.capability-matrix",{"title":148,"path":149,"stem":150},"Errors","\u002Freference\u002Ferrors","5.reference\u002F3.errors",{"title":152,"path":153,"stem":154},"Environment variables","\u002Freference\u002Fenvironment-variables","5.reference\u002F4.environment-variables",{"title":156,"path":157,"stem":158},"JSON Schemas","\u002Freference\u002Fjson-schemas","5.reference\u002F5.json-schemas",{"title":160,"icon":161,"path":162,"stem":163,"children":164,"page":22},"Examples","i-lucide-boxes","\u002Fexamples","6.examples",[165,169,173],{"title":166,"path":167,"stem":168},"Inbox CLI","\u002Fexamples\u002Finbox-cli","6.examples\u002F1.inbox-cli",{"title":170,"path":171,"stem":172},"Label bot","\u002Fexamples\u002Flabel-bot","6.examples\u002F2.label-bot",{"title":174,"path":175,"stem":176},"Release digest","\u002Fexamples\u002Frelease-digest","6.examples\u002F3.release-digest",{"title":178,"icon":179,"path":180,"stem":181,"children":182,"page":22},"Contributing","i-lucide-git-pull-request","\u002Fcontributing","7.contributing",[183,187,191,195],{"title":184,"path":185,"stem":186},"Contribution guide","\u002Fcontributing\u002Fguidelines","7.contributing\u002F1.guidelines",{"title":188,"path":189,"stem":190},"Write a provider","\u002Fcontributing\u002Fwrite-a-provider","7.contributing\u002F2.write-a-provider",{"title":192,"path":193,"stem":194},"Record fixtures","\u002Fcontributing\u002Frecord-fixtures","7.contributing\u002F3.record-fixtures",{"title":196,"path":197,"stem":198},"Contributors","\u002Fcontributing\u002Fcontributors","7.contributing\u002F4.contributors",{"id":200,"title":30,"body":201,"description":797,"extension":798,"links":799,"meta":800,"navigation":273,"path":31,"seo":802,"stem":32,"__hash__":803},"docs\u002F2.guides\u002F1.authentication.md",{"type":202,"value":203,"toc":790},"minimark",[204,218,223,226,367,386,390,399,452,456,485,592,602,606,610,616,650,662,666,669,778,786],[205,206,207,208,212,213,217],"p",{},"Every provider takes an ",[209,210,211],"code",{},"auth"," option. The accepted types differ by forge, so check the ",[214,215,216],"a",{"href":90},"provider page"," for yours.",[219,220,222],"h2",{"id":221},"use-a-token","Use a token",[205,224,225],{},"Most forges accept a token:",[227,228,233],"pre",{"className":229,"code":230,"language":231,"meta":232,"style":232},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import { gitlab } from 'forges\u002Fgitlab'\n\nconst forge = gitlab({\n  auth: { type: 'token', token: process.env.GITLAB_TOKEN! },\n}).create()\n","ts","",[209,234,235,268,275,297,350],{"__ignoreMap":232},[236,237,240,244,248,252,255,258,261,265],"span",{"class":238,"line":239},"line",1,[236,241,243],{"class":242},"s7zQu","import",[236,245,247],{"class":246},"sMK4o"," {",[236,249,251],{"class":250},"sTEyZ"," gitlab",[236,253,254],{"class":246}," }",[236,256,257],{"class":242}," from",[236,259,260],{"class":246}," '",[236,262,264],{"class":263},"sfazB","forges\u002Fgitlab",[236,266,267],{"class":246},"'\n",[236,269,271],{"class":238,"line":270},2,[236,272,274],{"emptyLinePlaceholder":273},true,"\n",[236,276,278,282,285,288,291,294],{"class":238,"line":277},3,[236,279,281],{"class":280},"spNyl","const",[236,283,284],{"class":250}," forge ",[236,286,287],{"class":246},"=",[236,289,251],{"class":290},"s2Zo4",[236,292,293],{"class":250},"(",[236,295,296],{"class":246},"{\n",[236,298,300,304,307,309,312,314,316,319,322,325,328,330,333,336,339,341,344,347],{"class":238,"line":299},4,[236,301,303],{"class":302},"swJcz","  auth",[236,305,306],{"class":246},":",[236,308,247],{"class":246},[236,310,311],{"class":302}," type",[236,313,306],{"class":246},[236,315,260],{"class":246},[236,317,318],{"class":263},"token",[236,320,321],{"class":246},"'",[236,323,324],{"class":246},",",[236,326,327],{"class":302}," token",[236,329,306],{"class":246},[236,331,332],{"class":250}," process",[236,334,335],{"class":246},".",[236,337,338],{"class":250},"env",[236,340,335],{"class":246},[236,342,343],{"class":250},"GITLAB_TOKEN",[236,345,346],{"class":246},"!",[236,348,349],{"class":246}," },\n",[236,351,353,356,359,361,364],{"class":238,"line":352},5,[236,354,355],{"class":246},"}",[236,357,358],{"class":250},")",[236,360,335],{"class":246},[236,362,363],{"class":290},"create",[236,365,366],{"class":250},"()\n",[205,368,369,370,373,374,377,378,381,382,385],{},"The other types are ",[209,371,372],{},"basic"," for a username and password, ",[209,375,376],{},"app"," for GitHub App and Cursor Origin App credentials and ",[209,379,380],{},"app_password"," and ",[209,383,384],{},"oauth"," on Tangled.",[219,387,389],{"id":388},"read-without-credentials","Read without credentials",[205,391,392,393,395,396,306],{},"Leave out ",[209,394,211],{}," for an anonymous provider. It sends no credentials and makes public reads only. Writes, notifications and subscriptions report ",[209,397,398],{},"false",[227,400,402],{"className":229,"code":401,"language":231,"meta":232,"style":232},"import { github } from 'forges\u002Fgithub'\n\nconst publicGitHub = github({}).create()\n",[209,403,404,424,428],{"__ignoreMap":232},[236,405,406,408,410,413,415,417,419,422],{"class":238,"line":239},[236,407,243],{"class":242},[236,409,247],{"class":246},[236,411,412],{"class":250}," github",[236,414,254],{"class":246},[236,416,257],{"class":242},[236,418,260],{"class":246},[236,420,421],{"class":263},"forges\u002Fgithub",[236,423,267],{"class":246},[236,425,426],{"class":238,"line":270},[236,427,274],{"emptyLinePlaceholder":273},[236,429,430,432,435,437,439,441,444,446,448,450],{"class":238,"line":277},[236,431,281],{"class":280},[236,433,434],{"class":250}," publicGitHub ",[236,436,287],{"class":246},[236,438,412],{"class":290},[236,440,293],{"class":250},[236,442,443],{"class":246},"{}",[236,445,358],{"class":250},[236,447,335],{"class":246},[236,449,363],{"class":290},[236,451,366],{"class":250},[219,453,455],{"id":454},"limit-a-credential-to-reads","Limit a credential to reads",[205,457,458,459,462,463,465,466,469,470,473,474,477,478,481,482,306],{},"Set ",[209,460,461],{},"readOnly: true"," to use a credential for reads only. Every write reports ",[209,464,398],{}," and rejects with ",[209,467,468],{},"ReadOnlyError",". This includes ",[209,471,472],{},"provider.request()"," with a method other than ",[209,475,476],{},"GET",", ",[209,479,480],{},"HEAD"," or ",[209,483,484],{},"OPTIONS",[227,486,488],{"className":229,"code":487,"language":231,"meta":232,"style":232},"import { gitlab } from 'forges\u002Fgitlab'\n\nconst audit = gitlab({\n  auth: { type: 'token', token: process.env.GITLAB_TOKEN! },\n  readOnly: true,\n}).create()\n",[209,489,490,508,512,527,565,579],{"__ignoreMap":232},[236,491,492,494,496,498,500,502,504,506],{"class":238,"line":239},[236,493,243],{"class":242},[236,495,247],{"class":246},[236,497,251],{"class":250},[236,499,254],{"class":246},[236,501,257],{"class":242},[236,503,260],{"class":246},[236,505,264],{"class":263},[236,507,267],{"class":246},[236,509,510],{"class":238,"line":270},[236,511,274],{"emptyLinePlaceholder":273},[236,513,514,516,519,521,523,525],{"class":238,"line":277},[236,515,281],{"class":280},[236,517,518],{"class":250}," audit ",[236,520,287],{"class":246},[236,522,251],{"class":290},[236,524,293],{"class":250},[236,526,296],{"class":246},[236,528,529,531,533,535,537,539,541,543,545,547,549,551,553,555,557,559,561,563],{"class":238,"line":299},[236,530,303],{"class":302},[236,532,306],{"class":246},[236,534,247],{"class":246},[236,536,311],{"class":302},[236,538,306],{"class":246},[236,540,260],{"class":246},[236,542,318],{"class":263},[236,544,321],{"class":246},[236,546,324],{"class":246},[236,548,327],{"class":302},[236,550,306],{"class":246},[236,552,332],{"class":250},[236,554,335],{"class":246},[236,556,338],{"class":250},[236,558,335],{"class":246},[236,560,343],{"class":250},[236,562,346],{"class":246},[236,564,349],{"class":246},[236,566,567,570,572,576],{"class":238,"line":352},[236,568,569],{"class":302},"  readOnly",[236,571,306],{"class":246},[236,573,575],{"class":574},"sfNiH"," true",[236,577,578],{"class":246},",\n",[236,580,582,584,586,588,590],{"class":238,"line":581},6,[236,583,355],{"class":246},[236,585,358],{"class":250},[236,587,335],{"class":246},[236,589,363],{"class":290},[236,591,366],{"class":250},[205,593,594,595,598,599,601],{},"Pass ",[209,596,597],{},"mutates: false"," to ",[209,600,472],{}," for a request that only reads, such as a GraphQL query.",[603,604,605],"warning",{},"The guard relies on the caller's declaration. It doesn't restrict the credential's permissions on the forge, so create a read-only token as well.",[219,607,609],{"id":608},"show-the-scopes-an-operation-needs","Show the scopes an operation needs",[205,611,612,615],{},[209,613,614],{},"provider.scopesFor(verb)"," returns the token scopes or app permissions that an operation needs on that forge. Use it for a consent screen or an error message:",[227,617,619],{"className":229,"code":618,"language":231,"meta":232,"style":232},"const needed = forge.scopesFor('threads.merge')\n",[209,620,621],{"__ignoreMap":232},[236,622,623,625,628,630,633,635,638,640,642,645,647],{"class":238,"line":239},[236,624,281],{"class":280},[236,626,627],{"class":250}," needed ",[236,629,287],{"class":246},[236,631,632],{"class":250}," forge",[236,634,335],{"class":246},[236,636,637],{"class":290},"scopesFor",[236,639,293],{"class":250},[236,641,321],{"class":246},[236,643,644],{"class":263},"threads.merge",[236,646,321],{"class":246},[236,648,649],{"class":250},")\n",[205,651,652,653,477,655,381,658,661],{},"The result has optional ",[209,654,318],{},[209,656,657],{},"permissions",[209,659,660],{},"note"," fields. A verb with no mapping returns an empty object.",[219,663,665],{"id":664},"authenticate-as-a-github-app","Authenticate as a GitHub App",[205,667,668],{},"Pass the app ID, the private key and an installation:",[227,670,672],{"className":229,"code":671,"language":231,"meta":232,"style":232},"const app = github({\n  auth: {\n    type: 'app',\n    appId: 123456,\n    privateKey: process.env.GITHUB_APP_PRIVATE_KEY!,\n    installationId: 7890,\n  },\n}).create()\n",[209,673,674,689,698,713,726,747,759,765],{"__ignoreMap":232},[236,675,676,678,681,683,685,687],{"class":238,"line":239},[236,677,281],{"class":280},[236,679,680],{"class":250}," app ",[236,682,287],{"class":246},[236,684,412],{"class":290},[236,686,293],{"class":250},[236,688,296],{"class":246},[236,690,691,693,695],{"class":238,"line":270},[236,692,303],{"class":302},[236,694,306],{"class":246},[236,696,697],{"class":246}," {\n",[236,699,700,703,705,707,709,711],{"class":238,"line":277},[236,701,702],{"class":302},"    type",[236,704,306],{"class":246},[236,706,260],{"class":246},[236,708,376],{"class":263},[236,710,321],{"class":246},[236,712,578],{"class":246},[236,714,715,718,720,724],{"class":238,"line":299},[236,716,717],{"class":302},"    appId",[236,719,306],{"class":246},[236,721,723],{"class":722},"sbssI"," 123456",[236,725,578],{"class":246},[236,727,728,731,733,735,737,739,741,744],{"class":238,"line":352},[236,729,730],{"class":302},"    privateKey",[236,732,306],{"class":246},[236,734,332],{"class":250},[236,736,335],{"class":246},[236,738,338],{"class":250},[236,740,335],{"class":246},[236,742,743],{"class":250},"GITHUB_APP_PRIVATE_KEY",[236,745,746],{"class":246},"!,\n",[236,748,749,752,754,757],{"class":238,"line":581},[236,750,751],{"class":302},"    installationId",[236,753,306],{"class":246},[236,755,756],{"class":722}," 7890",[236,758,578],{"class":246},[236,760,762],{"class":238,"line":761},7,[236,763,764],{"class":246},"  },\n",[236,766,768,770,772,774,776],{"class":238,"line":767},8,[236,769,355],{"class":246},[236,771,358],{"class":250},[236,773,335],{"class":246},[236,775,363],{"class":290},[236,777,366],{"class":250},[205,779,780,781,785],{},"The provider mints and caches installation tokens as it needs them. The ",[214,782,784],{"href":783},"\u002Fproviders\u002Fgithub#authentication","GitHub provider page"," explains how to work with several installations.",[787,788,789],"style",{},"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 .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}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 .sfNiH, html code.shiki .sfNiH{--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}",{"title":232,"searchDepth":270,"depth":270,"links":791},[792,793,794,795,796],{"id":221,"depth":270,"text":222},{"id":388,"depth":270,"text":389},{"id":454,"depth":270,"text":455},{"id":608,"depth":270,"text":609},{"id":664,"depth":270,"text":665},"Pass credentials to a provider, and limit what they can do.","md",null,{"icon":801},"i-lucide-key-round",{"title":30,"description":797},"AePouIMzSPCFCBbH9jda3tlkuVioSeCzoRh2AEf6TFQ",[805,807],{"title":19,"path":20,"stem":21,"description":806,"children":-1},"Read an issue, write a comment and add a second forge.",{"title":34,"path":35,"stem":36,"description":808,"children":-1},"Register several providers and route calls by ref or by URL.",1791296693868]