1/*! For license information please see 5fcbb102.9a9d85bc.js.LICENSE.txt */ 2(self.webpackChunk_okteto_website_docs=self.webpackChunk_okteto_website_docs||[]).push([[7360],{6172:(e,n,t)=>{"use strict";t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>c,default:()=>p,frontMatter:()=>a,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"core/credentials/personal-access-tokens","title":"Personal Access Tokens","description":"Use Personal Access Tokens to Interact with the Okteto API","source":"@site/src/content/core/credentials/personal-access-tokens.mdx","sourceDirName":"core/credentials","slug":"/core/credentials/personal-access-tokens","permalink":"/docs/1.49/core/credentials/personal-access-tokens","draft":false,"unlisted":false,"editUrl":"https://github.com/okteto/docs/edit/main/src/content/core/credentials/personal-access-tokens.mdx","tags":[],"version":"current","frontMatter":{"title":"Personal Access Tokens","description":"Use Personal Access Tokens to Interact with the Okteto API","sidebar_label":"Personal Access Tokens","id":"personal-access-tokens"},"sidebar":"docs","previous":{"title":"Kubernetes credentials","permalink":"/docs/1.49/core/credentials/kubernetes-credentials"},"next":{"title":"Environment Variables","permalink":"/docs/1.49/core/credentials/environment-variables"}}');var o=t(74848),r=t(28453),i=t(22475);const a={title:"Personal Access Tokens",description:"Use Personal Access Tokens to Interact with the Okteto API",sidebar_label:"Personal Access Tokens",id:"personal-access-tokens"},c=void 0,l={},d=[{value:"Creating a Personal Access Token",id:"creating-a-personal-access-token",level:3},{value:"Token Expiration",id:"token-expiration",level:3},{value:"Using a Token on the Command Line",id:"using-a-token-on-the-command-line",level:2},{value:"Revoking a Personal Access Token",id:"revoking-a-personal-access-token",level:3}];function h(e){const n={a:"a",admonition:"admonition",code:"code",h2:"h2",h3:"h3",li:"li",ol:"ol",p:"p",pre:"pre",strong:"strong",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.p,{children:"You can use Personal Access Tokens instead of OAuth to authenticate with Okteto. They're especially useful for scripting."}),"\n",(0,o.jsxs)(n.p,{children:[(0,o.jsx)(n.strong,{children:"Important"}),": For shared automations, like ",(0,o.jsx)(n.a,{href:"/docs/1.49/previews/",children:"Preview Environments"}),", it's recommended that you use ",(0,o.jsx)(n.a,{href:"/docs/1.49/admin/dashboard#admin-access-tokens",children:"Admin Access Tokens"}),". They're created in the same way as described here, but through the ",(0,o.jsx)(n.a,{href:"/docs/1.49/admin/dashboard#admin-access-tokens",children:"Admin dashboard"}),"."]}),"\n",(0,o.jsx)(n.h3,{id:"creating-a-personal-access-token",children:"Creating a Personal Access Token"}),"\n",(0,o.jsxs)(n.ol,{children:["\n",(0,o.jsx)(n.li,{children:"Navigate to the Okteto Dashboard"}),"\n",(0,o.jsxs)(n.li,{children:["Click on the ",(0,o.jsx)(n.strong,{children:"Settings"})," icon on the navigation bar at the left."]}),"\n",(0,o.jsxs)(n.li,{children:["Click on the ",(0,o.jsx)(n.strong,{children:"Personal Access Tokens"})," sidebar item."]}),"\n",(0,o.jsxs)(n.li,{children:["Click on the ",(0,o.jsx)(n.strong,{children:"New Token"})," button.","\n",(0,o.jsx)("p",{align:"center",children:(0,o.jsx)(i.A,{src:t(89331).A,alt:"Personal Access Tokens settings page listing tokens with Renew and Delete actions",width:"850"})}),"\n"]}),"\n",(0,o.jsxs)(n.li,{children:["Give your token a descriptive name, select the expiration, and click the ",(0,o.jsx)(n.strong,{children:"Generate"})," button.","\n",(0,o.jsx)("p",{align:"center",children:(0,o.jsx)(i.A,{src:t(21352).A,alt:"New Token dialog with name and expiration dropdown fields",width:"630"})}),"\n"]}),"\n",(0,o.jsxs)(n.li,{children:["Copy the token to your clipboard. For security reasons, after you navigate off the page, you will not see the token again.","\n",(0,o.jsx)("p",{align:"center",children:(0,o.jsx)(i.A,{src:t(99350).A,alt:"New Token dialog showing the generated token value with a Copy button",width:"630"})}),"\n"]}),"\n"]}),"\n",(0,o.jsx)(n.admonition,{type:"warning",children:(0,o.jsx)(n.p,{children:"Treat your tokens like passwords and keep them secret. Always use tokens as environment variables instead of hardcoding them into your programs."})}),"\n",(0,o.jsx)(n.h3,{id:"token-expiration",children:"Token Expiration"}),"\n",(0,o.jsx)(n.p,{children:"When you create a token, you can select the expiration, the default expiration is 180 days. Once a token has expired, it can no longer be used to authenticate or for API requests. It is not possible to restore an expired token, you will need to create a new token upon expiration."}),"\n",(0,o.jsx)(n.p,{children:"A banner will be displayed a week before your token expires to remind you of this. We recommend that you take the appropriate measures once you see this banner in order to prevent any potential disruptions."}),"\n",(0,o.jsx)("p",{align:"center",children:(0,o.jsx)(i.A,{src:t(31687).A,alt:"tokens expiration banner",width:"850"})}),"\n",(0,o.jsx)(n.p,{children:"The state and expiration date of every token will be displayed in the UI."}),"\n",(0,o.jsx)("p",{align:"center",children:(0,o.jsx)(i.A,{src:t(90812).A,alt:"tokens expiration banner",width:"850"})}),"\n",(0,o.jsx)(n.h2,{id:"using-a-token-on-the-command-line",children:"Using a Token on the Command Line"}),"\n",(0,o.jsxs)(n.p,{children:["Once you have a token, you can use it to authenticate with the ",(0,o.jsx)(n.a,{href:"/docs/1.49/reference/okteto-cli",children:"Okteto CLI"})," instead of using your browser, as shown below:"]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-bash",children:"okteto context use https://okteto.example.com --token $YOUR_TOKEN\n"})}),"\n",(0,o.jsxs)(n.p,{children:["Personal Access Tokens can also be used when setting the ",(0,o.jsx)(n.code,{children:"OKTETO_TOKEN"})," environment variable."]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-bash",children:"export OKTETO_TOKEN=xxxxxxx\nokteto namespace create test-cindy\n"})}),"\n",(0,o.jsx)(n.h3,{id:"revoking-a-personal-access-token",children:"Revoking a Personal Access Token"}),"\n",(0,o.jsxs)(n.ol,{children:["\n",(0,o.jsx)(n.li,{children:"Sign in to your Okteto account."}),"\n",(0,o.jsxs)(n.li,{children:["Click on the ",(0,o.jsx)(n.strong,{children:"Settings"})," icon on the left tab."]}),"\n",(0,o.jsxs)(n.li,{children:["Click on the ",(0,o.jsx)(n.strong,{children:"Personal Access Tokens"})," sidebar item."]}),"\n",(0,o.jsxs)(n.li,{children:["Click on the ",(0,o.jsx)(n.strong,{children:"Delete"})," button.","\n",(0,o.jsx)("p",{align:"center",children:(0,o.jsx)(i.A,{src:t(89331).A,alt:"Personal Access Tokens settings page highlighting the Delete button on a token",width:"850"})}),"\n"]}),"\n",(0,o.jsxs)(n.li,{children:["Click on the ",(0,o.jsx)(n.strong,{children:"Delete Token"})," button to confirm that you want to delete your token.","\n",(0,o.jsx)("p",{align:"center",children:(0,o.jsx)(i.A,{src:t(20019).A,alt:"confirm token deletion",width:"478"})}),"\n"]}),"\n"]}),"\n",(0,o.jsx)(n.p,{children:"Once deleted, the token is automatically revoked, and it can't be recovered."})]})}function p(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(h,{...e})}):h(e)}},20019:(e,n,t)=>{"use strict";t.d(n,{A:()=>s});const s=t.p+"assets/images/tokens-delete-confirm-e61160d95d8ec41043a0169c88bb898b.png"},21352:(e,n,t)=>{"use strict";t.d(n,{A:()=>s});const s=t.p+"assets/images/tokens-name-9c769f61a6e462f039f5fb272476fd9b.png"},22475:(e,n,t)=>{"use strict";t.d(n,{A:()=>l});t(96540);var s=t(46942),o=t.n(s);const r="Image_BJUz",i="ImageCenter_fE7C",a="ImageBorderless_Quyg";var c=t(74848);const l=function(e){let{src:n,loading:t}=e;if(!n.match(/^((http|https):\/\/|\/)/)&&"undefined"!=typeof window){n=("/"+window.location.pathname.replace(/index\.[a-z]+$/,"").split("/").filter(
2Boolean).slice(0,-1).join("/")+"/"+n).replace(/\/{2,}/,"/")}const s=Object.assign({},e,{src:n,loading:t||"lazy",center:void 0,borderless:void 0});return(0,c.jsx)("img",Object.assign({},s,{className:o()(r,{[i]:e.center,[a]:e.borderless})}))}},28453:(e,n,t)=>{"use strict";t.d(n,{R:()=>i,x:()=>a});var s=t(96540);const o={},r=s.createContext(o);function i(e){const n=s.useContext(r);return s.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),s.createElement(r.Provider,{value:n},e.children)}},31687:(e,n,t)=>{"use strict";t.d(n,{A:()=>s});const s=t.p+"assets/images/tokens-expiration-banner-sidebar+1.32-5bfe11d65f38c8ae7682ab44874d1c3a.png"},46942:(e,n)=>{var t;!function(){"use strict";var s={}.hasOwnProperty;function o(){for(var e="",n=0;n<arguments.length;n++){var t=arguments[n];t&&(e=i(e,r(t)))}return e}function r(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return o.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var n="";for(var t in e)s.call(e,t)&&e[t]&&(n=i(n,t));return n}function i(e,n){return n?e?e+" "+n:e+n:e}e.exports?(o.default=o,e.exports=o):void 0===(t=function(){return o}.apply(n,[]))||(e.exports=t)}()},89331:(e,n,t)=>{"use strict";t.d(n,{A:()=>s});const s=t.p+"assets/images/tokens-new-sidebar+1.32-befd0e3f50a81d1a15d1b3b13728e023.png"},90812:(e,n,t)=>{"use strict";t.d(n,{A:()=>s});const s=t.p+"assets/images/tokens-expiration-list+1.32-f980535e4e766b9d70c02859ef4f4742.png"},99350:(e,n,t)=>{"use strict";t.d(n,{A:()=>s});const s=t.p+"assets/images/tokens-copy-4b005f041fe80658a0226c733f94a2de.png"}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.