Registration Code | Printfil

if (response.statusCode() == 200) JsonNode node = mapper.readTree(response.body()); System.out.println("Access token: " + node.get("access_token").asText()); else System.err.println("Failed: " + response.body());

HttpRequest request = HttpRequest.newBuilder() .uri(URI.create(API_URL)) .header("Content-Type", "application/json") .timeout(Duration.ofSeconds(10)) .POST(HttpRequest.BodyPublishers.ofString(requestBody)) .build();

public static void main(String[] args) throws Exception HttpClient client = HttpClient.newHttpClient(); ObjectMapper mapper = new ObjectMapper(); printfil registration code

: Some providers embed all information inside a JWT , e.g.:

PRF-<tenant‑id>-<expiry>-<signature> | Segment | Example | What It Encodes | |---------|---------|-----------------| | PRF | PRF | Fixed prefix identifying the product (PrintFil). | | <tenant‑id> | A7B9 | A short, unique identifier for the customer. | | <expiry> | 2026-12-31 | Date (or Unix timestamp) after which the code is invalid. | | <signature> | 5F9C2E1A | HMAC/SHA‑256 hash computed over the previous fields using a secret key held only by the service provider. | if (response

public class PrintFilAuth private static final String REG_CODE = System.getenv("PRTFIL_REG_CODE"); private static final String API_URL = "https://api.printfil.io/v1/auth/register";

if resp.ok: token = resp.json()["access_token"] print("Authenticated! Token:", token) else: raise RuntimeError(f"Registration failed: resp.text") const axios = require('axios'); require('dotenv').config(); // loads .env → process.env | | &lt;signature&gt; | 5F9C2E1A | HMAC/SHA‑256 hash

(async () => try const data = await axios.post(API_URL, registration_code: REG_CODE ); console.log('Access token:', data.access_token); catch (err) )(); import java.net.URI; import java.net.http.*; import java.time.Duration; import com.fasterxml.jackson.databind.*;