Documentation Index
Fetch the complete documentation index at: https://docs.firstwork.com/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Embed the Firstwork hiring platform inside your own application using an<iframe> and a JWT-based magic login. Candidates land directly in their application without a second sign-in, while authentication stays secure because tokens are signed on your backend with a shared secret.
If an applicant with the supplied
email does not yet exist in the configured hiring flow, Firstwork automatically creates the applicant and their application using the identity claims in the JWT (email, first_name, last_name, funnel_name). If they already exist, their existing application is reused. Either way, they are logged in seamlessly inside the iframe — no separate sign-up step is required.How it works
- Your backend signs a short-lived JWT containing the applicant’s identity using a shared
SECRET_KEY(provided by Firstwork). - Your frontend fetches the token from your backend and sets the iframe
srctohttps://<company_name>.firstwork.com/magic-login/?token=<jwt>. - Firstwork verifies the JWT, creates or finds the applicant’s application, and logs them in inside the iframe.
Security principles
- JWT authentication: JSON Web Tokens are signed with a shared secret using HS256.
- Token generation on backend: Tokens must be generated server-side, never in the frontend.
- Short-lived tokens: Always set an
expclaim to limit exposure (e.g. 5 minutes). - iframe embedding: Embed Firstwork only over HTTPS using the magic login URL.
Step-by-step integration
Get credentials from Firstwork
Obtain your
SECRET_KEY and hiring_flow_id from Firstwork. Configure the funnel in the Firstwork UI and note its funnel_name (slug).Implement the backend token endpoint
Create a server-side endpoint that signs a JWT with your
SECRET_KEY and returns it to the frontend. See the Node.js example below.Embed the iframe in your frontend
Fetch the token from your backend and set it as the
token query parameter on the magic-login URL used as the iframe src.Code examples
JWT Payload
| Field | Type | Required | Description |
|---|---|---|---|
email | string | Yes | Applicant’s email address |
first_name | string | Yes | Applicant’s first name |
last_name | string | Yes | Applicant’s last name |
hiring_flow_id | string (UUID) | Conditional | Hiring flow identifier provided by Firstwork. Required if funnel_name is not provided. |
scope | string | Yes | Must be LOGIN_FOR_APPLICANT |
funnel_name | string | Conditional | Funnel slug for which the applicant will be registered. Required if hiring_flow_id is not provided. |
exp | integer | Yes | Expiration as a Unix timestamp. Keep short-lived (e.g. now + 5 minutes) |
HS256 algorithm.
Configuration
| Parameter | Description |
|---|---|
SECRET_KEY | A shared secret to sign JWT tokens. Provided by Firstwork. |
| Firstwork URL | https://<company_name>.firstwork.com/magic-login/ |
Passing extra slug parameters
To pass slug parameters for the application during registration, append them as query parameters to the iframe link:
Best practices
- Never expose
SECRET_KEYin the frontend code. - Always set a short expiration (
exp) in the JWT. - Only embed Firstwork domains via HTTPS.
- Log JWT generation events for traceability.
- Use HTTPS on your backend endpoint to protect token transmission.