LogoLogo
To the Oz WebsiteOz API ReferenceContact Us
  • General
    • Oz Liveness and Biometry Key Concepts
      • Solution Architecture
      • Liveness, Face Matching, Black List Checks
      • Passive and Active Liveness
      • Oz API Key Concepts
      • Oz API vs. Oz API Lite
      • SaaS, On-premise, On-device: What to Choose
      • Oz Licensing Options
    • Integration Quick Start Guides
      • Server-Based Liveness
        • How to Integrate Server-Based Liveness into Your Web Application
        • How to Integrate Server-Based Liveness into Your Mobile Application
        • How to Check Your Media for Liveness without Oz Front End
      • On-Device Liveness
        • How to Integrate On-Device Liveness into Your Mobile Application
      • Face Matching
        • How to Add Face Matching of Liveness Video with a Reference Photo From Your Database
        • How to Add Photo ID Capture and Face Matching to Your Web or Mobile Application
  • Guides
    • Developer Guide
      • API
        • Oz API
          • Basic Scenarios
            • Liveness
              • Best Shot
            • Biometry (Face Matching)
            • Blacklist (O2N) Check
              • Blacklist (Collection) Management in Oz API
          • Single Request
          • Instant API: Non-Persistent Mode
          • Authentication and Non-Instant Data Handling
            • Authentication
              • How to Issue a Service Token
            • Uploading Media
            • Quantitative Results
            • Using a Webhook to Get Results
          • System Objects
          • User Roles
          • Types of Analyses and What They Check
          • Rules of Assigning Analyses
          • Statuses in API
          • Media Tags
          • Metadata
          • API Error Codes
          • Oz API Postman Collections
          • Changelog
        • Oz API Lite
          • API Lite Methods
          • Oz API Lite Postman Collection
          • Changelog
      • SDK
        • Oz Mobile SDK (iOS, Android, Flutter)
          • Android
            • Getting a License for Android SDK
              • Master License for Android
            • Adding SDK to a Project
            • Connecting SDK to API
            • Capturing Videos
            • Checking Liveness and Face Biometry
            • Customizing Android SDK
              • How to Restore the Previous Design after an Update
            • Android Localization: Adding a Custom or Updating an Existing Language Pack
            • Android SDK Methods and Properties
            • Changelog
          • iOS
            • Getting a License for iOS SDK
              • Master License for iOS
            • Adding SDK to a Client’s Mobile App
            • Connecting SDK to API
            • Capturing Videos
            • Checking Liveness and Face Biometry
            • Customizing iOS SDK Interface
              • How to Restore the Previous Design after an Update
            • iOS Localization: Adding a Custom or Updating an Existing Language Pack
            • iOS SDK Methods and Properties
            • Changelog
          • Flutter
            • How to Install and Use Oz Flutter Plugin
            • Flutter SDK Methods and Properties
            • Changelog
        • Oz Liveness Web SDK
          • Web Plugin
            • Adding the Plugin to Your Web Page
            • Launching the Plugin
              • Description of the on_complete Callback
              • Description of the on_result Callback
              • Capturing Video and Description of the on_capture_complete Callback
              • Description of the on_error Callback
            • Closing or Hiding the Plugin
            • Localization: Adding a Custom Language Pack
            • Look-and-Feel Customization
              • Customization Options for Older Versions (before 1.0.1)
            • Security Recommendations
            • Browser Compatibility
            • No-Server Licensing
          • Changelog
    • Administrator Guide
      • Deployment Architecture
      • Installation in Docker
      • Installation in Kubernetes
      • Performance and Scalability Guide
      • Publishing API Methods in the Internet: Security Recommendations
      • Monitoring
      • License Server
      • Web Adapter Configuration
        • Installation and Licensing
        • Configuration File Settings
        • Configuration Using Environment Variables
        • Server Configuration via Environment Variables
      • Oz API Configuration
    • User Guide
      • Oz Web UI
        • Requesting Analyses
        • Users and Companies
        • Blacklist
        • Statistics
        • Settings
        • Changelog
  • Other
    • Media Quality Requirements
    • Oz SDK Media Quality Checks
    • Media File Size Overview
    • Compatibility
    • FAQ
    • Hybrid Liveness
    • Tips and Tricks
      • Oz Liveness Gestures: Table of Correspondence
      • Sudo without Password
      • Android: Certificate Validation Error
    • Previous Documentation
      • Mobile SDK
        • Android
          • Interactions with the Oz API Server
          • Uploading and Analyzing Media
        • iOS
          • Uploading and Analyzing Media
      • User Guides
        • Oz Demo Kit
        • Web UI
      • Oz Modules Installation
        • Standalone Installer
        • Oz System Lite
Powered by GitBook
On this page
  • Step 1
  • Step 2 (optional)
  • Step 3
  • Step 4

Was this helpful?

Export as PDF
  1. Guides
  2. Developer Guide
  3. API
  4. Oz API
  5. Authentication and Non-Instant Data Handling
  6. Authentication

How to Issue a Service Token

Here’s a step-by-step guide on how to issue a service token in Oz API 5 and 6.

1

Step 1

Authorize using your ADMIN account: {{host}}/api/authorize/auth.

Example request

curl -L 'https://{{host}}/api/authorize/auth' \
-H 'Content-Type: application/json' \
--data-raw '{
    "credentials": {
        "email": "admin_email@email.com",
        "password": "your_admin_password"
    }
}'

Example response

{
  …
    "user": {
        "user_type": "ADMIN",
  …
    },
    "access_token": "<token>",
    …
}
2

Step 2 (optional)

This step can be omitted if a company already exists.

As a user must belong to a company, create a company: call {{host}}/api/companies/ with your company name.

Example request

curl -L 'https://{{host}}/api/companies/'
-H 'X-Forensic-Access-Token: token_id'
-H 'Content-Type: application/json'
-d '{ "name": "your_company_name" }'

Example response

{
    "company_id": "company_id",
    "name": "your_company_name",
    "in_deletion": false,
    "technical_meta_data": {}
}
3

Step 3

Create a service user. Call {{host}}/api/users/ and write down user_id that you will get in response.

Example request

 curl -L 'https://{{host}}/api/users/'
-H 'X-Forensic-Access-Token: token_id'
-H 'Content-Type: application/json'
--data-raw '{
  "credentials": {
    "email": "<your_new_service_user@email.com>",
    "password": "<your_service_user_password>"
  },
  "profile": {
    "company_id": " company_id",
    <!-- the next line is for API 6 -->
    "user_type": "CLIENT_SERVICE",
    "first_name": "first_name",
    "last_name": "last_name",
    "middle_name": "",
    "is_admin": false,
    <!-- the next line is for API 5 and below -->
    "is_service": true,
    "can_start_analyse_biometry": true,
    "can_start_analyse_collection": true,
    "can_start_analyse_documents": true,
    "can_start_analyse_quality": true
  }
}

Example response

{
    "user_id": "user_id",
    "user_type": "CLIENT_SERVICE",
     …
    "is_active": true,
     …
    "is_service": true
}

As in API 6.0, the logic of issuing a service token has slightly changed, here are examples for both API 6 and API 5 (and below) cases.

API 6

In the request body, define user_type as CLIENT_SERVICE.

{
  "credentials": {
    "email": " <your_new_service_user@email.com> ",
    "password": "your_client_service_user_password"
  },
  "profile": {
    "company_id": "{{company_id}}",
    "user_type": "CLIENT_SERVICE",
    "first_name": "john",
    "last_name": "doe",
    "middle_name": "",
    "can_start_analysis_biometry": true,
    "can_start_analysis_collection": true,
    "can_start_analysis_documents": true,
    "can_start_analysis_quality": true
  }
}

API 5 and below

Set the is_service flag value to true.

{
    "credentials": {
        "email": "john.doe_client_service@ozforensics.com",
        "password": "your_client_service_user_password"
    },
    "profile": {
        "company_id": "{{company_id}}",
        "user_type": "CLIENT",
        "first_name": "john",
        "last_name": "doe",
        "middle_name": "",
        "is_admin": false,
        "is_service": true,
        "can_start_analyse_biometry": true,
        "can_start_analyse_collection": true,
        "can_start_analyse_documents": true,
        "can_start_analyse_quality": true
    }
}
4

Step 4

If you need to obtain the service token to use it, for instance, with Web SDK, authorize as ADMIN (same as in Step 1) and call:

  • API 6: {{host}}/api/authorize/service_token/{user_id} with user_id from the previous step.

  • API 5 and below: {{host}}/api/authorize/service_token.

Example request

curl -L 'https://{{host}}/api/authorize/service_token/{{user_id}}' \
-H 'X-Forensic-Access-Token: token_id' \
-H 'Content-Type: application/json'

Example response

{
    "token_id": "token_id",
    "user_id": "user_id",
    "access_token": "service_token",
    "expire_date": 1904659888.282587,
    "session_id": 0
}

In response, you will get a service token that you can use in any service processes.

For Web SDK, specify this token’s value as api_token in the Web Adapter configuration file.

PreviousAuthenticationNextUploading Media

Last updated 13 hours ago

Was this helpful?