2:I[2734,["231","static/chunks/231-987d5c3e911703df.js","458","static/chunks/458-4089d99a84ebbe2b.js","235","static/chunks/235-5238db898b5afbf7.js","940","static/chunks/app/authentication/page-d3906909a32486ee.js"],"Heading"] 3:I[5294,["231","static/chunks/231-987d5c3e911703df.js","458","static/chunks/458-4089d99a84ebbe2b.js","235","static/chunks/235-5238db898b5afbf7.js","940","static/chunks/app/authentication/page-d3906909a32486ee.js"],"Pre"] 4:I[5294,["231","static/chunks/231-987d5c3e911703df.js","458","static/chunks/458-4089d99a84ebbe2b.js","235","static/chunks/235-5238db898b5afbf7.js","940","static/chunks/app/authentication/page-d3906909a32486ee.js"],"Code"] 6:I[231,["231","static/chunks/231-987d5c3e911703df.js","458","static/chunks/458-4089d99a84ebbe2b.js","235","static/chunks/235-5238db898b5afbf7.js","940","static/chunks/app/authentication/page-d3906909a32486ee.js"],""] 8:I[2403,["231","static/chunks/231-987d5c3e911703df.js","458","static/chunks/458-4089d99a84ebbe2b.js","235","static/chunks/235-5238db898b5afbf7.js","940","static/chunks/app/authentication/page-d3906909a32486ee.js"],"Feedback"] 9:I[9275,[],""] a:I[1343,[],""] 5:Tc0e,const response = await fetch(`${API_URL}${uri}`, { method, headers: { Authorization: `Bearer ${token}`, 'user-agent': 'gologin-api', 'Content-Type': 'application/json; charset=utf-8', }, body: JSON.stringify(json), }); 7:Tabc,const gologin = GologinApi({ token }); const proxies = await httpApi('/users-proxies/mobile-proxy', { json: { countryCode, browserId: '', isMobile: false, isDC: false, }, }); 0:["6ZCz-VlG0khrc3itF4UQu",[[["",{"children":["authentication",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["authentication",{"children":["__PAGE__",{},[["$L1",["$","article",null,{"className":"flex h-full flex-col pb-10 pt-16","children":[["$","div",null,{"className":"flex-auto prose dark:prose-invert [html_:where(&>*)]:mx-auto [html_:where(&>*)]:max-w-2xl [html_:where(&>*)]:lg:mx-[calc(50%-min(50%,theme(maxWidth.lg)))] [html_:where(&>*)]:lg:max-w-3xl","children":[["$","h1",null,{"children":"Authentication"}],"\n",["$","p",null,{"children":"You'll need to authenticate your requests to access any of the endpoints in the GoLogin API. In this guide, we'll look at how authentication works. GoLogin offers two ways to authenticate your API requests: Basic authentication and OAuth2 with a token — OAuth2 is the recommended way.","className":"lead"}],"\n",["$","$L2",null,{"level":2,"id":"o-auth2-with-bearer-token","children":"OAuth2 with bearer token"}],"\n",["$","p",null,{"children":"With raw http API authentication, you use your API token to authenticate your HTTP requests. Here's how to authenticate using fetch:"}],"\n",["$","$L3",null,{"language":"bash","code":"const response = await fetch(`${API_URL}${uri}`, {\n method,\n headers: {\n Authorization: `Bearer ${token}`,\n 'user-agent': 'gologin-api',\n 'Content-Type': 'application/json; charset=utf-8',\n },\n body: JSON.stringify(json),\n});\n","children":["$","$L4",null,{"className":"language-bash","children":"$5"}],"title":"Internal request authentication implementation"}],"\n",["$","p",null,{"children":"Please don't commit your GoLogin password or token to git or GitHub!"}],"\n",["$","$L2",null,{"level":2,"id":"using-an-gologin-api-instance","children":"Using an GologinApi instance"}],"\n",["$","p",null,{"children":["The recommended way to authenticate with the GoLogin API is by using SDK.\nWhen establishing a connection using OAuth2, you will need your access token — you will find it in the ",["$","$L6",null,{"href":"https://app.gologin.com/personalArea/TokenApi","children":"GoLogin dashboard"}]," under API settings. Here's how to add the token to the request header using cURL:"]}],"\n",["$","$L3",null,{"language":"js","code":"const gologin = GologinApi({ token });\nconst proxies = await httpApi('/users-proxies/mobile-proxy', {\n json: {\n countryCode,\n browserId: '',\n isMobile: false,\n isDC: false,\n },\n});\n","children":["$","$L4",null,{"className":"language-js","children":"$7"}],"title":"JavaScript API request example"}],"\n",["$","p",null,{"children":"Always keep your token safe and reset it if you suspect it has been compromised."}],"\n",["$","$L2",null,{"level":2,"id":"using-an-sdk","children":"Using an SDK"}],"\n",["$","p",null,{"children":["If you use one of our official SDKs, you won't have to worry about any of the above — fetch your access token from the ",["$","$L6",null,{"href":"https://app.gologin.com/personalArea/TokenApi","children":"GoLogin dashboard"}]," under API settings, and the client library will take care of the rest. All the client libraries use OAuth2 behind the scenes."]}],"\n",["$","div",null,{"className":"not-prose","children":["$","$L6",null,{"className":"inline-flex gap-0.5 justify-center overflow-hidden text-sm font-medium transition text-emerald-500 hover:text-emerald-600 dark:text-emerald-400 dark:hover:text-emerald-500","href":"/sdks","children":[false,"Check out our list of first-party SDKs",["$","svg",null,{"viewBox":"0 0 20 20","fill":"none","aria-hidden":"true","className":"mt-0.5 h-5 w-5 relative top-px -mr-1","children":["$","path",null,{"stroke":"currentColor","strokeLinecap":"round","strokeLinejoin":"round","d":"m11.5 6.5 3 3.5m0 0-3 3.5m3-3.5h-9"}]}]]}]}]]}],["$","footer",null,{"className":"mx-auto mt-16 w-full max-w-2xl lg:max-w-5xl","children":["$","$L8",null,{}]}]]}]],null],null]},["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","authentication","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$La",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","styles":null}],null]},["$Lb",null],null],[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/027cc402be06af88.css","precedence":"next","crossOrigin":"$undefined"}]],"$Lc"]]]] c:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"charSet":"utf-8"}],["$","title","2",{"children":"Authentication - GoLogin API Reference"}],["$","meta","3",{"name":"description","content":"In this guide, we’ll look at how authentication works. GoLogin offers two ways to authenticate your API requests: Basic authentication and OAuth2 with a token."}],["$","link","4",{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"16x16"}]] 1:null d:I[2650,["231","static/chunks/231-987d5c3e911703df.js","458","static/chunks/458-4089d99a84ebbe2b.js","533","static/chunks/533-463131cc62f06a62.js","173","static/chunks/173-fc203c72e72da31b.js","192","static/chunks/192-bdca0343973e6cb5.js","235","static/chunks/235-5238db898b5afbf7.js","185","static/chunks/app/layout-1476186cd824e018.js"],"Providers"] e:I[7010,["231","static/chunks/231-987d5c3e911703df.js","458","static/chunks/458-4089d99a84ebbe2b.js","533","static/chunks/533-463131cc62f06a62.js","173","static/chunks/173-fc203c72e72da31b.js","192","static/chunks/192-bdca0343973e6cb5.js","235","static/chunks/235-5238db898b5afbf7.js","185","static/chunks/app/layout-1476186cd824e018.js"],"Layout"] f:I[4080,["231","static/chunks/231-987d5c3e911703df.js","458","static/chunks/458-4089d99a84ebbe2b.js","533","static/chunks/533-463131cc62f06a62.js","173","static/chunks/173-fc203c72e72da31b.js","192","static/chunks/192-bdca0343973e6cb5.js","235","static/chunks/235-5238db898b5afbf7.js","185","static/chunks/app/layout-1476186cd824e018.js"],""] 10:T47c, const APP_ID = 'izr1nygf'; const user = { // user_id: 1, // email: 'dima.kaigorod@gmail.com', // name: '' }; window.intercomSettings = { api_base: "https://api-iam.intercom.io", app_id: APP_ID, user_id: user.user_id, // IMPORTANT: Replace "user.id" with the variable you use to capture the user's ID name: user.name, // IMPORTANT: Replace "user.name" with the variable you use to capture the user's name email: user.email, // IMPORTANT: Replace "user.email" with the variable you use to capture the user's email address }; (function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('update',w.intercomSettings);}else{var d=document;var i=function(){i.c(arguments);};i.q=[];i.c=function(args){i.q.push(args);};w.Intercom=i;var l=function(){var s=d.createElement('script');s.type='text/javascript';s.async=true;s.src='https://widget.intercom.io/widget/' + APP_ID;var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s, x);};if(document.readyState==='complete'){l();}else if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})(); b:["$","html",null,{"lang":"en","className":"h-full","suppressHydrationWarning":true,"children":["$","body",null,{"className":"flex min-h-full bg-white antialiased dark:bg-zinc-900","children":[["$","$Ld",null,{"children":["$","div",null,{"className":"w-full","children":["$","$Le",null,{"allSections":{"/":[{"title":"Guides","id":"guides"},{"title":"Resources","id":"resources"}],"/attachments":[{"title":"The attachment model","id":"the-attachment-model"},{"title":"List all attachments","id":"list-all-attachments","tag":"GET","label":"/v1/attachments"},{"title":"Create an attachment","id":"create-an-attachment","tag":"POST","label":"/v1/attachments"},{"title":"Retrieve an attachment","id":"retrieve-an-attachment","tag":"GET","label":"/v1/attachments/:id"},{"title":"Update an attachment","id":"update-an-attachment","tag":"PUT","label":"/v1/attachments/:id"},{"title":"Delete an attachment","id":"delete-an-attachment","tag":"DELETE","label":"/v1/attachments/:id"}],"/authentication":[{"title":"OAuth2 with bearer token","id":"o-auth2-with-bearer-token"},{"title":"Using an GologinApi instance","id":"using-an-gologin-api-instance"},{"title":"Using an SDK","id":"using-an-sdk"}],"/cloud":[{"title":"Make your first run of browser in the cloud","id":"make-your-first-run-of-browser-in-the-cloud"},{"title":"Running code yourself","id":"running-code-yourself"},{"title":"What's next?","id":"whats-next"}],"/contacts":[{"title":"The contact model","id":"the-contact-model"},{"title":"List all contacts","id":"list-all-contacts","tag":"GET","label":"/v1/contacts"},{"title":"Create a contact","id":"create-a-contact","tag":"POST","label":"/v1/contacts"},{"title":"Retrieve a contact","id":"retrieve-a-contact","tag":"GET","label":"/v1/contacts/:id"},{"title":"Update a contact","id":"update-a-contact","tag":"PUT","label":"/v1/contacts/:id"},{"title":"Delete a contact","id":"delete-a-contact","tag":"DELETE","label":"/v1/contacts/:id"}],"/conversations":[{"title":"The conversation model","id":"the-conversation-model"},{"title":"List all conversations","id":"list-all-conversations","tag":"GET","label":"/v1/conversations"},{"title":"Create a conversation","id":"create-a-conversation","tag":"POST","label":"/v1/conversations"},{"title":"Retrieve a conversation","id":"retrieve-a-conversation","tag":"GET","label":"/v1/conversations/:id"},{"title":"Update a conversation","id":"update-a-conversation","tag":"PUT","label":"/v1/conversations/:id"},{"title":"Delete a conversation","id":"delete-a-conversation","tag":"DELETE","label":"/v1/conversations/:id"}],"/custom-proxies":[{"title":"Clone and run headless scraping browser code sample","id":"clone-and-run-headless-scraping-browser-code-sample"},{"title":"What's next?","id":"whats-next"}],"/errors":[{"title":"Status codes","id":"status-codes"},{"title":"Error types","id":"error-types"}],"/headless":[{"title":"Clone and run headless scraping browser code sample","id":"clone-and-run-headless-scraping-browser-code-sample"},{"title":"What's next?","id":"whats-next"}],"/profiles":[{"title":"List all groups","id":"list-all-groups","tag":"GET","label":"/v1/groups"},{"title":"Create a group","id":"create-a-group","tag":"POST","label":"/v1/groups"},{"title":"Retrieve a group","id":"retrieve-a-group","tag":"GET","label":"/v1/groups/:id"},{"title":"Update a group","id":"update-a-group","tag":"PUT","label":"/v1/groups/:id"},{"title":"Delete a group","id":"delete-a-group","tag":"DELETE","label":"/v1/groups/:id"}],"/provided-proxies":[{"title":"Clone and run headless scraping browser code sample","id":"clone-and-run-headless-scraping-browser-code-sample"},{"title":"What's next?","id":"whats-next"}],"/quickstart":[{"title":"Making your first anonymous scrapping request","id":"making-your-first-anonymous-scrapping-request"},{"title":"What this script does, step by step","id":"what-this-script-does-step-by-step"},{"title":"Running code yourself","id":"running-code-yourself"},{"title":"What's next?","id":"whats-next"}],"/recaptcha":[{"title":"Making your first anonymous scrapping request","id":"making-your-first-anonymous-scrapping-request"},{"title":"What this script does, step by step","id":"what-this-script-does-step-by-step"},{"title":"Running code yourself","id":"running-code-yourself"},{"title":"What's next?","id":"whats-next"}],"/sdks":[{"title":"Official libraries","id":"official-libraries"}]},"children":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$La",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","div",null,{"className":"absolute inset-0 -z-10 mx-0 max-w-none overflow-hidden","children":["$","div",null,{"className":"absolute left-1/2 top-0 ml-[-38rem] h-[25rem] w-[81.25rem] dark:[mask-image:linear-gradient(white,transparent)]","children":[["$","div",null,{"className":"absolute inset-0 bg-gradient-to-r from-[#36b49f] to-[#DBFF75] opacity-40 [mask-image:radial-gradient(farthest-side_at_top,white,transparent)] dark:from-[#36b49f]/30 dark:to-[#DBFF75]/30 dark:opacity-100","children":["$","svg",null,{"aria-hidden":"true","className":"absolute inset-x-0 inset-y-[-50%] h-[200%] w-full skew-y-[-18deg] fill-black/40 stroke-black/50 mix-blend-overlay dark:fill-white/2.5 dark:stroke-white/5","children":[["$","defs",null,{"children":["$","pattern",null,{"id":":S1:","width":72,"height":56,"patternUnits":"userSpaceOnUse","x":-12,"y":4,"children":["$","path",null,{"d":"M.5 56V.5H72","fill":"none"}]}]}],["$","rect",null,{"width":"100%","height":"100%","strokeWidth":0,"fill":"url(#:S1:)"}],["$","svg",null,{"x":-12,"y":4,"className":"overflow-visible","children":[["$","rect","4-3",{"strokeWidth":"0","width":73,"height":57,"x":288,"y":168}],["$","rect","2-1",{"strokeWidth":"0","width":73,"height":57,"x":144,"y":56}],["$","rect","7-3",{"strokeWidth":"0","width":73,"height":57,"x":504,"y":168}],["$","rect","10-6",{"strokeWidth":"0","width":73,"height":57,"x":720,"y":336}]]}]]}]}],["$","svg",null,{"viewBox":"0 0 1113 440","aria-hidden":"true","className":"absolute left-1/2 top-0 ml-[-19rem] w-[69.5625rem] fill-white blur-[26px] dark:hidden","children":["$","path",null,{"d":"M.016 439.5s-9.5-300 434-300S882.516 20 882.516 20V0h230.004v439.5H.016Z"}]}]]}]}],["$","div",null,{"className":"mx-auto flex h-full max-w-xl flex-col items-center justify-center py-16 text-center","children":[["$","p",null,{"className":"text-sm font-semibold text-zinc-900 dark:text-white","children":"404"}],["$","h1",null,{"className":"mt-2 text-2xl font-bold text-zinc-900 dark:text-white","children":"Page not found"}],["$","p",null,{"className":"mt-2 text-base text-zinc-600 dark:text-zinc-400","children":"Sorry, we couldn’t find the page you’re looking for."}],["$","$L6",null,{"className":"inline-flex gap-0.5 justify-center overflow-hidden text-sm font-medium transition rounded-full bg-zinc-900 py-1 px-3 text-white hover:bg-zinc-700 dark:bg-emerald-400/10 dark:text-emerald-400 dark:ring-1 dark:ring-inset dark:ring-emerald-400/20 dark:hover:bg-emerald-400/10 dark:hover:text-emerald-300 dark:hover:ring-emerald-300 mt-8","href":"/","children":[false,"Back to docs",["$","svg",null,{"viewBox":"0 0 20 20","fill":"none","aria-hidden":"true","className":"mt-0.5 h-5 w-5 -mr-1","children":["$","path",null,{"stroke":"currentColor","strokeLinecap":"round","strokeLinejoin":"round","d":"m11.5 6.5 3 3.5m0 0-3 3.5m3-3.5h-9"}]}]]}]]}]],"notFoundStyles":[],"styles":null}]}]}]}],["$","$Lf",null,{"id":"intercom","dangerouslySetInnerHTML":{"__html":"$10"}}]]}]}]