"use strict";(self.webpackChunkbaf=self.webpackChunkbaf||[]).push([[7902],{3636:(t,e,n)=>{n.r(e),n.d(e,{assets:()=>l,contentTitle:()=>r,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>d});var i=n(7896),a=(n(2784),n(876));const o={id:"api_baf_web_component_integrations",title:"Web component integration",sidebar_label:"Web component integration"},r=void 0,s={unversionedId:"user_guide/api_baf_web_component_integrations",id:"user_guide/api_baf_web_component_integrations",title:"Web component integration",description:"JWT session token generation",source:"@site/docs/user_guide/api_baf_web_component_integrations.md",sourceDirName:"user_guide",slug:"/user_guide/api_baf_web_component_integrations",permalink:"/user_guide/api_baf_web_component_integrations",draft:!1,tags:[],version:"current",frontMatter:{id:"api_baf_web_component_integrations",title:"Web component integration",sidebar_label:"Web component integration"},sidebar:"docs",previous:{title:"Report control",permalink:"/user_guide/api_baf_reports"},next:{title:"Web-component",permalink:"/user_guide/baf_web_component"}},l={},d=[{value:"JWT session token generation",id:"jwt-session-token-generation",level:2}],p={toc:d},c="wrapper";function u(t){let{components:e,...n}=t;return(0,a.kt)(c,(0,i.Z)({},p,n,{components:e,mdxType:"MDXLayout"}),(0,a.kt)("h2",{id:"jwt-session-token-generation"},"JWT session token generation"),(0,a.kt)("p",null,"The request returns a JWT token for interacting with the system API."),(0,a.kt)("p",null,"Endpoint: POST /publicapi/api/v2/public/WebComponentIntegrationsJwt/Generate"),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Request body:")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-cpp"},'{\n  "integrationId": "64422e66-911a-43cd-ad3a-5c9461c0b546",\n  "secret": "secret"\n}\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"integrationId")," - Integration ID"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"secret")," - Client secret (optional field)")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Example request:")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-cpp"},"curl -X 'POST' \\\n  'https://baf.3divi.ru/publicapi/api/v2/public/WebComponentIntegrationsJwt/Generate' \\\n  -H 'accept: text/plain' \\\n  -H 'Authorization: Bearer sk_100e682a-7459-4e53-a152-a8453c5e6ad3' \\\n  -H 'Content-Type: application/json-patch+json' \\\n  -d '{\n  \"integrationId\": \"64422e66-911a-43cd-ad3a-5c9461c0b546\",\n  \"secret\": \"secret\"\n}'\n")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Example response:")),(0,a.kt)("table",null,(0,a.kt)("body",null,(0,a.kt)("tr",null,(0,a.kt)("td",{width:"400"},"Status Code"),(0,a.kt)("td",{width:"400"},"200")))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-cpp"},'{\n  "accessToken": "eyJhbGci..."\n}\n')),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Possible errors:")),(0,a.kt)("table",null,(0,a.kt)("tbody",null,(0,a.kt)("tr",null,(0,a.kt)("td",{class:"center-aligned",width:"400"},(0,a.kt)("b",null,"Code")),(0,a.kt)("td",{class:"center-aligned",width:"400"},(0,a.kt)("b",null,"Message")),(0,a.kt)("td",{class:"center-aligned",width:"400"},(0,a.kt)("b",null,"Description")),(0,a.kt)("td",{class:"center-aligned",width:"400"},(0,a.kt)("b",null,"Code"))),(0,a.kt)("tr",null,(0,a.kt)("td",{width:"400"},"400"),(0,a.kt)("td",{width:"400"},"Integration with id 8783ed86-1c08-4a2c-9434-65a8f970f34b not found."),(0,a.kt)("td",{width:"400"},"Integration not found"),(0,a.kt)("td",{width:"400"},"120024")),(0,a.kt)("tr",null,(0,a.kt)("td",{width:"400"},"400"),(0,a.kt)("td",{width:"400"},"Client secret is invalid."),(0,a.kt)("td",{width:"400"},"Client secret is not provided or the provided value is incorrect."),(0,a.kt)("td",{width:"400"},"120049")),(0,a.kt)("tr",null,(0,a.kt)("td",{width:"400"},"400"),(0,a.kt)("td",{width:"400"},"Invalid authentication method used. Expected: JWT but integration uses: IntegrationID."),(0,a.kt)("td",{width:"400"},"The component authentication type does not support JWT token generation."),(0,a.kt)("td",{width:"400"},"120049")))))}u.isMDXComponent=!0}}]);