Ask AI
Table of contents

Thanks for Downloading Dynamic Web TWAIN 30-Day Trial!

Your download will start shortly. If your download does not begin, click here to retry.

Access Token

You can enable access token to avoid the APIs of Dynamic Web TWAIN Service being called by unknown applications for better security.

It can control the access via the JavaScript library and the REST APIs. Currently, only Windows is supported.

How to Use Token Validation

  1. Configure the service to enable token validation. Open CMD as administrator to run the following command.

    1. Set a password for the service, which is required to enable token validation.

      "C:\Program Files (x86)\Dynamsoft\Dynamic Web TWAIN Service 19\DynamicWebTWAINService.exe" Config --init 
      

      The password must be at least 8 characters long and include:

      • At least one uppercase letter
      • At least one lowercase letter
      • At least one special character
    2. Enable token validation.

      "C:\Program Files (x86)\Dynamsoft\Dynamic Web TWAIN Service 19\DynamicWebTWAINService.exe" Config global.token_policy required
      
    3. Restart the service to make the changes effective.

  2. Generate a token for the client to use. You can define its expiry duration. By default, the token never expires. Restart the service to make the changes effective.

    "C:\Program Files (x86)\Dynamsoft\Dynamic Web TWAIN Service 19\DynamicWebTWAINService.exe" Config --create-token "{\"duration\":864000}" 
    
  3. Use the token.

    • Using the JavaScript library, you need to set Dynamsoft.DWT.Token with the token you just generated.
    • Using the REST API, you need to set the header to use the token.

       const myHeaders = new Headers();        
       myHeaders.append("Authorization", "Bearer " + accessToken); 
       const response = await fetch(url, {"method":"GET",  headers: myHeaders});
      

Disable Password and Token Validation

Open DSConfiguration.ini under the service’s installation folder and delete “Auth=XXX”. Then restart the service.

Change Password

Run the following to change the password.

"C:\Program Files (x86)\Dynamsoft\Dynamic Web TWAIN Service 19\DynamicWebTWAINService.exe" Config --change-password

Access to the Configuration Page

When the password is enabled, you need to enter the password to access http://127.0.0.1:18625/. Check the steps above to learn how to enable and disable the password.