[{"data":1,"prerenderedAt":805},["ShallowReactive",2],{"navigation_docs":3,"-guides-authentication":195,"-guides-authentication-surround":800},[4,23,65,87,133,155,173],{"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],{"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},"JSON Schemas","\u002Freference\u002Fjson-schemas","5.reference\u002F5.json-schemas",{"title":156,"icon":157,"path":158,"stem":159,"children":160,"page":22},"Examples","i-lucide-boxes","\u002Fexamples","6.examples",[161,165,169],{"title":162,"path":163,"stem":164},"Inbox CLI","\u002Fexamples\u002Finbox-cli","6.examples\u002F1.inbox-cli",{"title":166,"path":167,"stem":168},"Label bot","\u002Fexamples\u002Flabel-bot","6.examples\u002F2.label-bot",{"title":170,"path":171,"stem":172},"Release digest","\u002Fexamples\u002Frelease-digest","6.examples\u002F3.release-digest",{"title":174,"icon":175,"path":176,"stem":177,"children":178,"page":22},"Contributing","i-lucide-git-pull-request","\u002Fcontributing","7.contributing",[179,183,187,191],{"title":180,"path":181,"stem":182},"Contribution guide","\u002Fcontributing\u002Fguidelines","7.contributing\u002F1.guidelines",{"title":184,"path":185,"stem":186},"Write a provider","\u002Fcontributing\u002Fwrite-a-provider","7.contributing\u002F2.write-a-provider",{"title":188,"path":189,"stem":190},"Record fixtures","\u002Fcontributing\u002Frecord-fixtures","7.contributing\u002F3.record-fixtures",{"title":192,"path":193,"stem":194},"Contributors","\u002Fcontributing\u002Fcontributors","7.contributing\u002F4.contributors",{"id":196,"title":30,"body":197,"description":793,"extension":794,"links":795,"meta":796,"navigation":269,"path":31,"seo":798,"stem":32,"__hash__":799},"docs\u002F2.guides\u002F1.authentication.md",{"type":198,"value":199,"toc":786},"minimark",[200,214,219,222,363,382,386,395,448,452,481,588,598,602,606,612,646,658,662,665,774,782],[201,202,203,204,208,209,213],"p",{},"Every provider takes an ",[205,206,207],"code",{},"auth"," option. The accepted types differ by forge, so check the ",[210,211,212],"a",{"href":90},"provider page"," for yours.",[215,216,218],"h2",{"id":217},"use-a-token","Use a token",[201,220,221],{},"Most forges accept a token:",[223,224,229],"pre",{"className":225,"code":226,"language":227,"meta":228,"style":228},"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","",[205,230,231,264,271,293,346],{"__ignoreMap":228},[232,233,236,240,244,248,251,254,257,261],"span",{"class":234,"line":235},"line",1,[232,237,239],{"class":238},"s7zQu","import",[232,241,243],{"class":242},"sMK4o"," {",[232,245,247],{"class":246},"sTEyZ"," gitlab",[232,249,250],{"class":242}," }",[232,252,253],{"class":238}," from",[232,255,256],{"class":242}," '",[232,258,260],{"class":259},"sfazB","forges\u002Fgitlab",[232,262,263],{"class":242},"'\n",[232,265,267],{"class":234,"line":266},2,[232,268,270],{"emptyLinePlaceholder":269},true,"\n",[232,272,274,278,281,284,287,290],{"class":234,"line":273},3,[232,275,277],{"class":276},"spNyl","const",[232,279,280],{"class":246}," forge ",[232,282,283],{"class":242},"=",[232,285,247],{"class":286},"s2Zo4",[232,288,289],{"class":246},"(",[232,291,292],{"class":242},"{\n",[232,294,296,300,303,305,308,310,312,315,318,321,324,326,329,332,335,337,340,343],{"class":234,"line":295},4,[232,297,299],{"class":298},"swJcz","  auth",[232,301,302],{"class":242},":",[232,304,243],{"class":242},[232,306,307],{"class":298}," type",[232,309,302],{"class":242},[232,311,256],{"class":242},[232,313,314],{"class":259},"token",[232,316,317],{"class":242},"'",[232,319,320],{"class":242},",",[232,322,323],{"class":298}," token",[232,325,302],{"class":242},[232,327,328],{"class":246}," process",[232,330,331],{"class":242},".",[232,333,334],{"class":246},"env",[232,336,331],{"class":242},[232,338,339],{"class":246},"GITLAB_TOKEN",[232,341,342],{"class":242},"!",[232,344,345],{"class":242}," },\n",[232,347,349,352,355,357,360],{"class":234,"line":348},5,[232,350,351],{"class":242},"}",[232,353,354],{"class":246},")",[232,356,331],{"class":242},[232,358,359],{"class":286},"create",[232,361,362],{"class":246},"()\n",[201,364,365,366,369,370,373,374,377,378,381],{},"The other types are ",[205,367,368],{},"basic"," for a username and password, ",[205,371,372],{},"app"," for GitHub App and Cursor Origin App credentials and ",[205,375,376],{},"app_password"," and ",[205,379,380],{},"oauth"," on Tangled.",[215,383,385],{"id":384},"read-without-credentials","Read without credentials",[201,387,388,389,391,392,302],{},"Leave out ",[205,390,207],{}," for an anonymous provider. It sends no credentials and makes public reads only. Writes, notifications and subscriptions report ",[205,393,394],{},"false",[223,396,398],{"className":225,"code":397,"language":227,"meta":228,"style":228},"import { github } from 'forges\u002Fgithub'\n\nconst publicGitHub = github({}).create()\n",[205,399,400,420,424],{"__ignoreMap":228},[232,401,402,404,406,409,411,413,415,418],{"class":234,"line":235},[232,403,239],{"class":238},[232,405,243],{"class":242},[232,407,408],{"class":246}," github",[232,410,250],{"class":242},[232,412,253],{"class":238},[232,414,256],{"class":242},[232,416,417],{"class":259},"forges\u002Fgithub",[232,419,263],{"class":242},[232,421,422],{"class":234,"line":266},[232,423,270],{"emptyLinePlaceholder":269},[232,425,426,428,431,433,435,437,440,442,444,446],{"class":234,"line":273},[232,427,277],{"class":276},[232,429,430],{"class":246}," publicGitHub ",[232,432,283],{"class":242},[232,434,408],{"class":286},[232,436,289],{"class":246},[232,438,439],{"class":242},"{}",[232,441,354],{"class":246},[232,443,331],{"class":242},[232,445,359],{"class":286},[232,447,362],{"class":246},[215,449,451],{"id":450},"limit-a-credential-to-reads","Limit a credential to reads",[201,453,454,455,458,459,461,462,465,466,469,470,473,474,477,478,302],{},"Set ",[205,456,457],{},"readOnly: true"," to use a credential for reads only. Every write reports ",[205,460,394],{}," and rejects with ",[205,463,464],{},"ReadOnlyError",". This includes ",[205,467,468],{},"provider.request()"," with a method other than ",[205,471,472],{},"GET",", ",[205,475,476],{},"HEAD"," or ",[205,479,480],{},"OPTIONS",[223,482,484],{"className":225,"code":483,"language":227,"meta":228,"style":228},"import { gitlab } from 'forges\u002Fgitlab'\n\nconst audit = gitlab({\n  auth: { type: 'token', token: process.env.GITLAB_TOKEN! },\n  readOnly: true,\n}).create()\n",[205,485,486,504,508,523,561,575],{"__ignoreMap":228},[232,487,488,490,492,494,496,498,500,502],{"class":234,"line":235},[232,489,239],{"class":238},[232,491,243],{"class":242},[232,493,247],{"class":246},[232,495,250],{"class":242},[232,497,253],{"class":238},[232,499,256],{"class":242},[232,501,260],{"class":259},[232,503,263],{"class":242},[232,505,506],{"class":234,"line":266},[232,507,270],{"emptyLinePlaceholder":269},[232,509,510,512,515,517,519,521],{"class":234,"line":273},[232,511,277],{"class":276},[232,513,514],{"class":246}," audit ",[232,516,283],{"class":242},[232,518,247],{"class":286},[232,520,289],{"class":246},[232,522,292],{"class":242},[232,524,525,527,529,531,533,535,537,539,541,543,545,547,549,551,553,555,557,559],{"class":234,"line":295},[232,526,299],{"class":298},[232,528,302],{"class":242},[232,530,243],{"class":242},[232,532,307],{"class":298},[232,534,302],{"class":242},[232,536,256],{"class":242},[232,538,314],{"class":259},[232,540,317],{"class":242},[232,542,320],{"class":242},[232,544,323],{"class":298},[232,546,302],{"class":242},[232,548,328],{"class":246},[232,550,331],{"class":242},[232,552,334],{"class":246},[232,554,331],{"class":242},[232,556,339],{"class":246},[232,558,342],{"class":242},[232,560,345],{"class":242},[232,562,563,566,568,572],{"class":234,"line":348},[232,564,565],{"class":298},"  readOnly",[232,567,302],{"class":242},[232,569,571],{"class":570},"sfNiH"," true",[232,573,574],{"class":242},",\n",[232,576,578,580,582,584,586],{"class":234,"line":577},6,[232,579,351],{"class":242},[232,581,354],{"class":246},[232,583,331],{"class":242},[232,585,359],{"class":286},[232,587,362],{"class":246},[201,589,590,591,594,595,597],{},"Pass ",[205,592,593],{},"mutates: false"," to ",[205,596,468],{}," for a request that only reads, such as a GraphQL query.",[599,600,601],"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.",[215,603,605],{"id":604},"show-the-scopes-an-operation-needs","Show the scopes an operation needs",[201,607,608,611],{},[205,609,610],{},"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:",[223,613,615],{"className":225,"code":614,"language":227,"meta":228,"style":228},"const needed = forge.scopesFor('threads.merge')\n",[205,616,617],{"__ignoreMap":228},[232,618,619,621,624,626,629,631,634,636,638,641,643],{"class":234,"line":235},[232,620,277],{"class":276},[232,622,623],{"class":246}," needed ",[232,625,283],{"class":242},[232,627,628],{"class":246}," forge",[232,630,331],{"class":242},[232,632,633],{"class":286},"scopesFor",[232,635,289],{"class":246},[232,637,317],{"class":242},[232,639,640],{"class":259},"threads.merge",[232,642,317],{"class":242},[232,644,645],{"class":246},")\n",[201,647,648,649,473,651,377,654,657],{},"The result has optional ",[205,650,314],{},[205,652,653],{},"permissions",[205,655,656],{},"note"," fields. A verb with no mapping returns an empty object.",[215,659,661],{"id":660},"authenticate-as-a-github-app","Authenticate as a GitHub App",[201,663,664],{},"Pass the app ID, the private key and an installation:",[223,666,668],{"className":225,"code":667,"language":227,"meta":228,"style":228},"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",[205,669,670,685,694,709,722,743,755,761],{"__ignoreMap":228},[232,671,672,674,677,679,681,683],{"class":234,"line":235},[232,673,277],{"class":276},[232,675,676],{"class":246}," app ",[232,678,283],{"class":242},[232,680,408],{"class":286},[232,682,289],{"class":246},[232,684,292],{"class":242},[232,686,687,689,691],{"class":234,"line":266},[232,688,299],{"class":298},[232,690,302],{"class":242},[232,692,693],{"class":242}," {\n",[232,695,696,699,701,703,705,707],{"class":234,"line":273},[232,697,698],{"class":298},"    type",[232,700,302],{"class":242},[232,702,256],{"class":242},[232,704,372],{"class":259},[232,706,317],{"class":242},[232,708,574],{"class":242},[232,710,711,714,716,720],{"class":234,"line":295},[232,712,713],{"class":298},"    appId",[232,715,302],{"class":242},[232,717,719],{"class":718},"sbssI"," 123456",[232,721,574],{"class":242},[232,723,724,727,729,731,733,735,737,740],{"class":234,"line":348},[232,725,726],{"class":298},"    privateKey",[232,728,302],{"class":242},[232,730,328],{"class":246},[232,732,331],{"class":242},[232,734,334],{"class":246},[232,736,331],{"class":242},[232,738,739],{"class":246},"GITHUB_APP_PRIVATE_KEY",[232,741,742],{"class":242},"!,\n",[232,744,745,748,750,753],{"class":234,"line":577},[232,746,747],{"class":298},"    installationId",[232,749,302],{"class":242},[232,751,752],{"class":718}," 7890",[232,754,574],{"class":242},[232,756,758],{"class":234,"line":757},7,[232,759,760],{"class":242},"  },\n",[232,762,764,766,768,770,772],{"class":234,"line":763},8,[232,765,351],{"class":242},[232,767,354],{"class":246},[232,769,331],{"class":242},[232,771,359],{"class":286},[232,773,362],{"class":246},[201,775,776,777,781],{},"The provider mints and caches installation tokens as it needs them. The ",[210,778,780],{"href":779},"\u002Fproviders\u002Fgithub#authentication","GitHub provider page"," explains how to work with several installations.",[783,784,785],"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":228,"searchDepth":266,"depth":266,"links":787},[788,789,790,791,792],{"id":217,"depth":266,"text":218},{"id":384,"depth":266,"text":385},{"id":450,"depth":266,"text":451},{"id":604,"depth":266,"text":605},{"id":660,"depth":266,"text":661},"Pass credentials to a provider, and limit what they can do.","md",null,{"icon":797},"i-lucide-key-round",{"title":30,"description":793},"AePouIMzSPCFCBbH9jda3tlkuVioSeCzoRh2AEf6TFQ",[801,803],{"title":19,"path":20,"stem":21,"description":802,"children":-1},"Read an issue, write a comment and add a second forge.",{"title":34,"path":35,"stem":36,"description":804,"children":-1},"Register several providers and route calls by ref or by URL.",1791294007783]