OAuth 2

This guide explains OAuth 2.0 authentication with Factorial HR and the two token types available. For step-by-step setup with Postman examples, see the Company Token and User Token guides.

Prerequisites

Before starting, make sure you have:

  • Admin access to Factorial HR
  • Access to the correct environment (Production or Demo), with Settings → Advanced configuration → OAuth applications available to your admin user (Production)
  • Postman access through browser or application
  • For the user token: a user assigned a specified permissions group

How to choose your environment: Environments: Production and Demo


Understanding Token Types

🏢 Company Token

A Company Token provides company-wide access to Factorial data. All actions are performed on behalf of the company, not a specific user.

PropertyDetails
Lifetime1 hour (requires refresh token to renew)
Use caseIntegrations that need full company data without user interaction
PermissionsFull access to all company data

👤 User Token

A User Token provides user-scoped access. All actions are performed on behalf of a specific employee, and access is limited by that employee's permission group.

PropertyDetails
Lifetime1 hour (requires refresh token to renew)
Use caseIntegrations with restricted access, hiding sensitive data from third parties
PermissionsLimited to the employee's permission group

OAuth applications

OAuth applications are created and managed by a Factorial admin in Settings → Advanced configuration → OAuth applications (open OAuth applications in Factorial). There you configure the application name, redirect URIs, scopes, client type, and client credentials.

Client types

When you create an OAuth application you choose how it authenticates:

Client typeIn FactorialRuns onAuthenticates with
ConfidentialConfidential client with secretA trusted backend that can keep a client secret privateClient secret when exchanging the authorization code for tokens
Non-confidential (public)Public client without secretBrowser SPAs, mobile apps, or desktop apps, where a secret cannot be protectedAuthorization Code + PKCE (no client secret)
  • Confidential clients run on a trusted backend and can keep a client secret private. They authenticate with that secret when exchanging an authorization code for tokens.
  • Non-confidential (public) clients run in environments where a secret cannot be protected, such as browser SPAs, mobile apps, or desktop apps. A client secret would be extractable, so it must not be relied on for authentication.
🔐

Public clients should use Authorization Code + PKCE

  1. Generate a random code_verifier locally.
  2. Derive a code_challenge from it and send that with the authorization request.
  3. Keep the verifier only in the client.
  4. Send the original verifier when exchanging the returned code for tokens.

Factorial ID endpoints

EndpointProductionDemo
Authorizehttps://id.factorialhr.com/oauth/authorizehttps://id.eu2.demo.factorial.dev/oauth/authorize
Token (exchange and refresh)https://id.factorialhr.com/api/oauth/tokenhttps://id.eu2.demo.factorial.dev/api/oauth/token
Revokehttps://id.factorialhr.com/api/oauth/revokehttps://id.eu2.demo.factorial.dev/api/oauth/revoke

Existing integrations can keep their current endpoints while they are migrated.

Support

If you have any issues or questions about the API, don't hesitate to get in touch with our Tech Support team by filling out one of the following forms:

➡️ Partner Developers Tech Support

➡️ Clients Customer Support


Did this page help you?