{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Generate Client Token Guide"},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"generate-client-token-guide","__idx":0},"children":["Generate Client Token Guide"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use this guide to generate a client token that will be used in the Authorization header when calling the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/generate-token"]}," API."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"prerequisites","__idx":1},"children":["Prerequisites"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["OpenSSL installed"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Node.js installed"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Your Promotexter user ID from Promotexter Support (support@promotexter.com)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["npm package: jsonwebtoken"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"step-by-step-guide","__idx":2},"children":["Step-by-Step Guide"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"step-1-generate-rsa-key-pair","__idx":3},"children":["Step 1: Generate RSA key pair"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"openssl genrsa -out private_key.pem 4096\nopenssl rsa -in private_key.pem -pubout -out public_key.pem\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Output:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["private_key.pem: keep this secure, do not share"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["public_key.pem: send this to Promotexter Support (support@promotexter.com)"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"step-2-install-dependency","__idx":4},"children":["Step 2: Install dependency"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"npm install jsonwebtoken\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"step-3-generate-client-token-nodejs-sample","__idx":5},"children":["Step 3: Generate client token (Node.js sample)"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"js","header":{"controls":{"copy":{}}},"source":"const fs = require(\"fs\");\nconst jwt = require(\"jsonwebtoken\");\n\n// Load your RSA private key\nconst privateKey = fs.readFileSync(\"private_key.pem\");\n\n// JWT signing options\nconst signOptions = {\n\tissuer: \"your-promotexter-user-id\",\n\texpiresIn: \"60s\",\n\talgorithm: \"RS512\"\n};\n\n// Create token\nconst token = jwt.sign({}, privateKey, signOptions);\n\nconsole.log(\"Client token:\");\nconsole.log(token);\n","lang":"js"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Important Notes:"]}]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["issuer"]}," must be your valid Promotexter user ID."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["expiresIn"]}," must not exceed 60 seconds. Otherwise, it will be treated as an invalid client token."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Use algorithm RS512."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Generate a unique key pair per user."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"step-4-use-client-token-in-generate-promotexter-token-api-request","__idx":6},"children":["Step 4: Use client token in Generate Promotexter Token API request"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"http","header":{"controls":{"copy":{}}},"source":"Authorization: Bearer <your-client-token>\n","lang":"http"},"children":[]}]},"headings":[{"value":"Generate Client Token Guide","id":"generate-client-token-guide","depth":1},{"value":"Prerequisites","id":"prerequisites","depth":2},{"value":"Step-by-Step Guide","id":"step-by-step-guide","depth":2},{"value":"Step 1: Generate RSA key pair","id":"step-1-generate-rsa-key-pair","depth":4},{"value":"Step 2: Install dependency","id":"step-2-install-dependency","depth":4},{"value":"Step 3: Generate client token (Node.js sample)","id":"step-3-generate-client-token-nodejs-sample","depth":4},{"value":"Step 4: Use client token in Generate Promotexter Token API request","id":"step-4-use-client-token-in-generate-promotexter-token-api-request","depth":4}],"frontmatter":{"seo":{"title":"Generate Client Token Guide"}},"lastModified":"2026-08-27T08:58:32.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/clienttoken","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}