1:HL["/_next/static/css/3db6122cc27c8de8.css",{"as":"style"}] 0:["TueFr3DgBqMH5pUDMQIwB",[[["",{"children":["sdk-auth",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],"$L2",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/3db6122cc27c8de8.css","precedence":"next"}]],"$L3"]]]] 2:[null,"$L4",null] 3:[["$","meta","0",{"charSet":"utf-8"}],["$","title","1",{"children":"SDK Authentication - Block-Auth API Reference"}],["$","meta","2",{"name":"description","content":"This guide will get you all set up and ready to use the Block-Auth SDK. We’ll cover how to get started an SDK client and how to make your first SDK request."}],["$","meta","3",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","link","4",{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"256x256"}]] 5:I{"id":1431,"chunks":["685:static/chunks/685-00eaf189776e499f.js","411:static/chunks/411-9586d5d3621ed092.js","21:static/chunks/21-7cecc0b8d96c28b4.js","361:static/chunks/361-306de3187f051a9b.js","379:static/chunks/379-8c339dbec83324f1.js","39:static/chunks/39-5ee607123f978930.js","185:static/chunks/app/layout-029d30f4466dc98a.js"],"name":"Providers","async":false} 6:I{"id":6848,"chunks":["685:static/chunks/685-00eaf189776e499f.js","411:static/chunks/411-9586d5d3621ed092.js","21:static/chunks/21-7cecc0b8d96c28b4.js","361:static/chunks/361-306de3187f051a9b.js","379:static/chunks/379-8c339dbec83324f1.js","39:static/chunks/39-5ee607123f978930.js","185:static/chunks/app/layout-029d30f4466dc98a.js"],"name":"Layout","async":false} 7:I{"id":7767,"chunks":["272:static/chunks/webpack-485b50192fb0a198.js","971:static/chunks/fd9d1056-0462299d818c8abc.js","596:static/chunks/596-0ef5ecc2d8dbbafa.js"],"name":"default","async":false} 8:I{"id":7920,"chunks":["272:static/chunks/webpack-485b50192fb0a198.js","971:static/chunks/fd9d1056-0462299d818c8abc.js","596:static/chunks/596-0ef5ecc2d8dbbafa.js"],"name":"default","async":false} 9:I{"id":6685,"chunks":["685:static/chunks/685-00eaf189776e499f.js","411:static/chunks/411-9586d5d3621ed092.js","39:static/chunks/39-5ee607123f978930.js","616:static/chunks/app/sdk-auth/page-8ee17282f9684bcc.js"],"name":"","async":false} b:I{"id":3971,"chunks":["685:static/chunks/685-00eaf189776e499f.js","411:static/chunks/411-9586d5d3621ed092.js","39:static/chunks/39-5ee607123f978930.js","616:static/chunks/app/sdk-auth/page-8ee17282f9684bcc.js"],"name":"Heading","async":false} c:I{"id":2140,"chunks":["685:static/chunks/685-00eaf189776e499f.js","411:static/chunks/411-9586d5d3621ed092.js","39:static/chunks/39-5ee607123f978930.js","616:static/chunks/app/sdk-auth/page-8ee17282f9684bcc.js"],"name":"CodeGroup","async":false} d:I{"id":2140,"chunks":["685:static/chunks/685-00eaf189776e499f.js","411:static/chunks/411-9586d5d3621ed092.js","39:static/chunks/39-5ee607123f978930.js","616:static/chunks/app/sdk-auth/page-8ee17282f9684bcc.js"],"name":"Pre","async":false} e:I{"id":2140,"chunks":["685:static/chunks/685-00eaf189776e499f.js","411:static/chunks/411-9586d5d3621ed092.js","39:static/chunks/39-5ee607123f978930.js","616:static/chunks/app/sdk-auth/page-8ee17282f9684bcc.js"],"name":"Code","async":false} 14:I{"id":1686,"chunks":["685:static/chunks/685-00eaf189776e499f.js","411:static/chunks/411-9586d5d3621ed092.js","39:static/chunks/39-5ee607123f978930.js","616:static/chunks/app/sdk-auth/page-8ee17282f9684bcc.js"],"name":"Feedback","async":false} f:Ta27,import { BlockAuthProvider } from 'blockauth-sdk' const provider = new BlockAuthProvider({ apiKey: 'your_api_key', apiSecret: 'your_api_secret', }) // allow your backend to connect to the block-auth provider (blockchain + api) await provider.connect() // allow to access to your app data with the block-auth provider await provider.signin() 10:Td38,import { BlockAuthProvider } from 'blockauth-sdk' const provider = new BlockAuthProvider({ apiKey: 'your_api_key', apiSecret: 'your_api_secret', }) const userAddress = '0x1234567890' // allow your backend to connect to the block-auth provider (blockchain + api) await provider.connect() // allow to access to your app data with the block-auth provider await provider.signin() await provider.isAddressSigned(userAddress) 11:T20db,import express from 'express' import { BlockAuthProvider } from 'blockauth-sdk' const app = express() const provider = new BlockAuthProvider({ apiKey: 'your_api_key', apiSecret: 'your_api_secret', }) // allow your backend to connect to the block-auth provider (blockchain + api) await provider.connect() // allow to access to your app data with the block-auth provider await provider.signin() app.get('/auth/:address', async (req, res) => { try { const { address } = req.params const res = await provider.isAddressSigned(address) res.status(200).json({ ...res }) } catch (error) { res.status(500).json({ success:false, error: error.message }) } }) app.listen(3000, () => { console.log('API REST running on port 3000') }) 12:T9b4, import express from 'express' import jwt from 'jsonwebtoken' import { BlockAuthProvider } from 'blockauth-sdk' const secretforJWT = 'secret' const app = express() const provider = new BlockAuthProvider({ apiKey: 'your_api_key', apiSecret: 'your_api_secret', }) // allow your backend to connect to the block-auth provider (blockchain + api) await provider.connect() // allow to access to your app data with the block-auth provider await provider.signin() console.log('[api][blockauth-sdk] provider READY to use for APP: ', await provider.app()) /** * Apply RCF6750 - bearer+1space+base64token * list of users must be contain at least one user * and the address must be the same as the one in the list * @param {*} users list of users queried from db * @param {*} addr address to be signed * @param {*} expiresIn token expiration time (from block-auth provider) */ const tokenCreateFromAddress = async (users, addr, expiresIn = '1h')=> { const errorToken = {"message":"Token not generated"}; const _addr = addr.toLowerCase() || ''; if(!_addr || _addr.length <= 0) throw Error(errorToken.message); if(users.length <= 0) throw Error(errorToken.message); if(users[0].addr.toLowerCase() !== _addr) throw Error(errorToken.message); const token = jwt.sign( {...users[0]}, secretforJWT, { expiresIn } ) return { accessToken: token, user: users[0] }; } app.get('/auth/:address', async (req, res) => { try { const { address } = req.params console.log("[api][/auth] by address: ", address) const { success, message } = await provider.isAddressSigned(address) || { success: false, message: 'Address not signed' } const { signedAt, signedExpiredAt } = message const diffInMs = new Date(signedExpiredAt).getTime() - new Date(signedAt).getTime(); const diffInSecs = Math.floor(diffInMs / 1000); console.log('[api]blockauth-sdk] signed user by addr+apiKey->', success, message, diffInSecs) if (!success) throw Error("Address not signed") // address signin, generate session with address // now front can save it at sessionstorage and use it for next requests session = (await tokenCreateFromAddress(users, address, diffInSecs)) const data = {"accessToken": session.accessToken} res.status(200).json({ success: true, data }) } catch (error) { res.status(500).json({ success:false, error: error.message }) } }) app.listen(3000, () => { console.log('API REST running on port 3000') }) 13:T6815, import express from 'express' import jwt from 'jsonwebtoken' import { BlockAuthProvider } from 'blockauth-sdk' const secretforJWT = 'secret' const app = express() const provider = new BlockAuthProvider({ apiKey: 'your_api_key', apiSecret: 'your_api_secret', }) // allow your backend to connect to the block-auth provider (blockchain + api) await provider.connect() // allow to access to your app data with the block-auth provider await provider.signin() console.log('[api][blockauth-sdk] provider READY to use for APP: ', await provider.app()) /** * Apply RCF6750 - bearer+1space+base64token * list of users must be contain at least one user * and the address must be the same as the one in the list * @param {*} users list of users queried from db * @param {*} addr address to be signed * @param {*} expiresIn token expiration time (from block-auth provider) */ const tokenCreateFromAddress = async (users, addr, expiresIn = '1h')=> { const errorToken = {"message":"Token not generated"}; const _addr = addr.toLowerCase() || ''; if(!_addr || _addr.length <= 0) throw Error(errorToken.message); if(users.length <= 0) throw Error(errorToken.message); if(users[0].addr.toLowerCase() !== _addr) throw Error(errorToken.message); const token = jwt.sign( {...users[0]}, secretforJWT, { expiresIn } ) return { accessToken: token, user: users[0] }; } app.get('/auth/:address', async (req, res) => { try { const { address } = req.params console.log("[api][/auth] by address: ", address) const { success, message } = await provider.isAddressSigned(address) || { success: false, message: 'Address not signed' } const { signedAt, signedExpiredAt } = message const diffInMs = new Date(signedExpiredAt).getTime() - new Date(signedAt).getTime(); const diffInSecs = Math.floor(diffInMs / 1000); console.log('[api]blockauth-sdk] signed user by addr+apiKey->', success, message, diffInSecs) if (!success) throw Error("Address not signed") // address signin, generate session with address // now front can save it at sessionstorage and use it for next requests session = (await tokenCreateFromAddress(users, address, diffInSecs)) const data = {"accessToken": session.accessToken} res.status(200).json({ success: true, data }) } catch (error) { res.status(500).json({ success:false, error: error.message }) } }) app.listen(3000, () => { console.log('API REST running on port 3000') }) 4:["$","html",null,{"lang":"en","className":"h-full","suppressHydrationWarning":true,"children":["$","body",null,{"className":"flex min-h-full bg-white antialiased dark:bg-blue-900","children":["$","$L5",null,{"children":["$","div",null,{"className":"w-full","children":["$","$L6",null,{"allSections":{"/":[{"title":"API Rest","id":"resources"},{"title":"SDKs","id":"resources"},{"title":"Browser Extension","id":"resources"},{"title":"Dashboard","id":"resources"}],"/api":[{"title":"Sending events from website to extension","id":"sending-events-from-website-to-extension"}],"/api-app":[{"title":"The app configuration model","id":"the-app-configuration-model"},{"title":"Get app configuration","id":"get-app-configuration","tag":"GET","label":"/api/app"}],"/api-auth":[{"title":"Basic authentication","id":"basic-authentication"},{"title":"Refresh token","id":"refresh-token"},{"title":"OAuth2 with bearer token","id":"o-auth2-with-bearer-token"},{"title":"Using an SDK","id":"using-an-sdk"}],"/api-intro":[{"title":"Guides","id":"guides"},{"title":"Resources","id":"resources"}],"/api-logs":[{"title":"The logs model","id":"the-logs-model"},{"title":"Get a list of logs","id":"get-a-list-of-logs","tag":"GET","label":"/api/logs"}],"/api-users":[{"title":"The user model","id":"the-user-model"},{"title":"Get a list of users","id":"get-a-list-of-users","tag":"GET","label":"/api/users"}],"/dashboard-guides":[{"title":"View: Applications","id":"view-applications"},{"title":"View: Users management","id":"view-users-management"},{"title":"View: Monitoring","id":"view-monitoring"},{"title":"View: Tenant management","id":"view-tenant-management"},{"title":"View: Modules","id":"view-modules"}],"/dashboard-intro":[{"title":"Guides","id":"guides"},{"title":"Resources","id":"resources"}],"/errors":[{"title":"Status codes","id":"status-codes"},{"title":"Error types","id":"error-types"}],"/extension-api":[{"title":"Sending events from website to extension","id":"sending-events-from-website-to-extension"}],"/extension-introduction":[{"title":"Getting started","id":"getting-started","anchor":false}],"/api-roles":[{"title":"The role model","id":"the-role-model"},{"title":"Get a list of roles","id":"get-a-list-of-roles","tag":"GET","label":"/api/roles"}],"/extension-quickstart":[{"title":"How to create an account","id":"how-to-create-an-account"},{"title":"How to sign in","id":"how-to-sign-in"},{"title":"How to link an account","id":"how-to-link-an-account"},{"title":"How to use OTP","id":"how-to-use-otp"}],"/pagination":[{"title":"Example using cursors","id":"example-using-cursors"}],"/sdk-app":[{"title":"The app model","id":"the-app-model"},{"title":"Get an App","id":"get-an-app","tag":"event","label":"sdk:app"}],"/sdk-auth":[{"title":"Choose your client","id":"choose-your-client"},{"title":"Connecting using credentials","id":"connecting-using-credentials"},{"title":"Verify USER is logged in or not into APP","id":"verify-user-is-logged-in-or-not-into-app"},{"title":"What's next?","id":"whats-next"}],"/sdk-intro":[{"title":"Official libraries","id":"official-libraries"}],"/sdk-logs":[{"title":"The app model","id":"the-app-model"},{"title":"Get an App","id":"get-an-app","tag":"event","label":"sdk:app"}],"/sdk-permissions":[{"title":"The app model","id":"the-app-model"},{"title":"Get an App","id":"get-an-app","tag":"event","label":"sdk:app"}],"/sdk-react":[{"title":"Choose your client","id":"choose-your-client"},{"title":"Connecting using credentials","id":"connecting-using-credentials"},{"title":"What's next?","id":"whats-next"}],"/sdk-roles":[{"title":"The rol model","id":"the-rol-model"},{"title":"Get an App","id":"get-an-app","tag":"event","label":"sdk:app"}],"/sdk-users":[{"title":"The app model","id":"the-app-model"},{"title":"Get an App","id":"get-an-app","tag":"event","label":"sdk:app"}],"/webhooks":[{"title":"Registering webhooks","id":"registering-webhooks"},{"title":"Consuming webhooks","id":"consuming-webhooks"},{"title":"Event types","id":"event-types"},{"title":"Security","id":"security"}]},"children":["$","$L7",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$L8",null,{}],"templateStyles":"$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-gray-900 dark:text-white","children":"404"}],["$","h1",null,{"className":"mt-2 text-2xl font-bold text-gray-900 dark:text-white","children":"Page not found"}],["$","p",null,{"className":"mt-2 text-base text-gray-600 dark:text-gray-400","children":"Sorry, we couldn’t find the page you’re looking for."}],["$","$L9",null,{"className":"inline-flex gap-0.5 justify-center overflow-hidden text-sm font-medium transition rounded-full bg-blue-900 py-1 px-3 text-white hover:bg-blue-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":[],"childProp":{"current":["$","$L7",null,{"parallelRouterKey":"children","segmentPath":["children","sdk-auth","children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$L8",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","childProp":{"current":["$La",["$","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 with the Block-Auth SDK"}],"\n",["$","p",null,{"children":"This guide will get you all set up and ready to use the Block-Auth SDK. We'll cover how to get started using one of our SDK clients and how to make your first SDK request. We'll also look at where to go next to find all the information you need to take full advantage of our powerful REST SDK.","className":"lead"}],"\n",["$","div",null,{"className":"my-6 flex gap-2.5 rounded-2xl border border-emerald-500/20 bg-emerald-50/50 p-4 leading-6 text-emerald-900 dark:border-emerald-500/30 dark:bg-emerald-500/5 dark:text-emerald-200 dark:[--tw-prose-links-hover:theme(colors.emerald.300)] dark:[--tw-prose-links:theme(colors.white)]","children":[["$","svg",null,{"viewBox":"0 0 16 16","aria-hidden":"true","className":"mt-1 h-4 w-4 flex-none fill-emerald-500 stroke-white dark:fill-emerald-200/20 dark:stroke-emerald-200","children":[["$","circle",null,{"cx":"8","cy":"8","r":"8","strokeWidth":"0"}],["$","path",null,{"fill":"none","strokeLinecap":"round","strokeLinejoin":"round","strokeWidth":"1.5","d":"M6.75 7.75h1.5v3.5"}],["$","circle",null,{"cx":"8","cy":"4","r":".5","fill":"none"}]]}],["$","div",null,{"className":"[&>:first-child]:mt-0 [&>:last-child]:mb-0","children":["$","p",null,{"children":["Before you can make requests to the Block-Auth SDK, you will need to grab your\nSDK keys from your dashboard. You find it under ",["$","$L9",null,{"href":"https://dashboard.block-auth.io/panel/apps/","children":"Applications » Settings"}],"."]}]}]]}],"\n",["$","$Lb",null,{"level":2,"id":"choose-your-client","children":"Choose your client"}],"\n",["$","p",null,{"children":"Before making your first request, you need to pick which SDK client you will use. Block-Auth offers clients for JavaScript. In the following example, you can see how to install client."}],"\n",["$","$Lc",null,{"children":["$","$Ld",null,{"language":"js","code":"# Install the Protocol JavaScript SDK\nnpm install blockauth-sdk --save\n","children":["$","$Le",null,{"className":"language-bash","children":"# Install the Protocol JavaScript SDK\nnpm install blockauth-sdk --save\n"}]}]}],"\n",["$","div",null,{"className":"not-prose","children":["$","$L9",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":"/sdk-intro","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"}]}]]}]}],"\n",["$","$Lb",null,{"level":2,"id":"connecting-using-credentials","children":"Connecting using credentials"}],"\n",["$","p",null,{"children":"After picking your preferred client, you are ready to make your first call to the Protocol SDK. Below, you can see how to send a GET request to the Conversations endpoint to get a list of all your conversations. In the cURL example, results are limited to ten conversations, the default page length for each client."}],"\n",["$","$Lc",null,{"tag":"SDK","label":"connection","children":["$","$Ld",null,{"language":"js","code":"import { BlockAuthProvider } from 'blockauth-sdk'\n\nconst provider = new BlockAuthProvider({\n apiKey: 'your_api_key',\n apiSecret: 'your_api_secret',\n})\n// allow your backend to connect to the block-auth provider (blockchain + api)\nawait provider.connect()\n// allow to access to your app data with the block-auth provider\nawait provider.signin()\n","children":["$","$Le",null,{"className":"language-js","children":"$f"}]}]}],"\n",["$","div",null,{"className":"not-prose","children":["$","$L9",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":"/api-auth","children":[false,"Read the docs for the Authentication events on API REST",["$","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"}]}]]}]}],"\n",["$","$Lb",null,{"level":2,"id":"verify-user-is-logged-in-or-not-into-app","children":"Verify USER is logged in or not into APP"}],"\n",["$","p",null,{"children":["We follow the standard down ",["$","$L9",null,{"href":"https://datatracker.ietf.org/doc/html/rfc6750","children":"RFC 6750"}],", where we use the Bearer token to authenticate the user. The user can be authenticated by the SDK using the ",["$","$Le",null,{"children":"isAddressSigned"}]," method."]}],"\n",["$","$Lc",null,{"tag":"SDK","label":"connection","children":["$","$Ld",null,{"language":"js","code":"import { BlockAuthProvider } from 'blockauth-sdk'\n\nconst provider = new BlockAuthProvider({\n apiKey: 'your_api_key',\n apiSecret: 'your_api_secret',\n})\nconst userAddress = '0x1234567890'\n// allow your backend to connect to the block-auth provider (blockchain + api)\nawait provider.connect()\n// allow to access to your app data with the block-auth provider\nawait provider.signin()\n\nawait provider.isAddressSigned(userAddress)\n","children":["$","$Le",null,{"className":"language-js","children":"$10"}]}]}],"\n",["$","div",null,{"className":"not-prose","children":["$","$L9",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":"/api-auth/#o-auth2-with-bearer-token","children":[false,"Read the docs for the Authentication events on API REST",["$","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"}]}]]}]}],"\n",["$","h3",null,{"children":"Example with EXPRESS api"}],"\n",["$","$Ld",null,{"language":"js","code":"import express from 'express'\nimport { BlockAuthProvider } from 'blockauth-sdk'\n\nconst app = express()\nconst provider = new BlockAuthProvider({\n apiKey: 'your_api_key',\n apiSecret: 'your_api_secret',\n})\n// allow your backend to connect to the block-auth provider (blockchain + api)\nawait provider.connect()\n// allow to access to your app data with the block-auth provider\nawait provider.signin()\n\napp.get('/auth/:address', async (req, res) => {\n try {\n const { address } = req.params\n const res = await provider.isAddressSigned(address)\n res.status(200).json({ ...res })\n } catch (error) {\n res.status(500).json({ success:false, error: error.message })\n }\n})\n\napp.listen(3000, () => {\n console.log('API REST running on port 3000')\n})\n\n","children":["$","$Le",null,{"className":"language-js","children":"$11"}]}],"\n",["$","h3",null,{"children":"Example with EXPRESS+JWT api"}],"\n",["$","$Ld",null,{"language":"js","code":"$12","children":["$","$Le",null,{"className":"language-js","children":"$13"}]}],"\n",["$","$Lb",null,{"level":2,"id":"whats-next","children":"What's next?"}],"\n",["$","p",null,{"children":"Great, you're now set up with an SDK client and have made your first request to the SDK. Here are a few links that might be handy as you venture further into the Protocol SDK:"}],"\n",["$","ul",null,{"children":["\n",["$","li",null,{"children":["$","$L9",null,{"href":"https://dashboard.block-auth.io/panel/apps/","children":"Grab your SDK keys from the Protocol dashboard"}]}],"\n",["$","li",null,{"children":["$","$L9",null,{"href":"/authentication","children":"Check out the Authentications events"}]}],"\n",["$","li",null,{"children":["$","$L9",null,{"href":"/errors","children":"Learn about the different error messages in Protocol"}]}],"\n"]}]]}],["$","footer",null,{"className":"mx-auto mt-16 w-full max-w-2xl lg:max-w-5xl","children":["$","$L14",null,{}]}]]}],null],"segment":"__PAGE__"},"styles":[]}],"segment":"sdk-auth"},"styles":[]}]}]}]}]}]}] a:null