Tutorial: Create Token URLs Using the Web API
Overview
This tutorial shows how to create token URLs using the Access Server Web API.
A token URL provides a secure, temporary link that allows users to download and import a connection profile directly into OpenVPN Connect. This can simplify profile distribution and onboarding by eliminating the need to manually download and import profile files.
Prerequisites
Access Server 3.1.0 or newer.
Root privileges on your Access Server's console.
(Optional) A remote machine for running API calls.
Step 1: Generate a token URL
Connect to the console and get root privileges.
Run one of the following commands based on the profile type you want to generate.
User-locked profile
sacli --method POST --url 'api/token-url' --value '{"profile_type":"userlogin", "username": "<USER_NAME>"}' apicallAuto-login profile
sacli --method POST --url 'api/token-url' --value '{"profile_type":"autologin", "username": "<USER_NAME>"}' apicallServer-locked profile
sacli --method POST --url 'api/token-url' --value '{"profile_type":"generic", "username": "<USER_NAME>"}' apicallGeneric ePKI profile
sacli --method POST --url 'api/token-url' --value '{"profile_type":"epki-generic", "username": "<USER_NAME>"}' apicallAuto-login ePKI profile
sacli --method POST --url 'api/token-url' --value '{"profile_type":"epki-autologin", "username": "<USER_NAME>"}' apicallResult
The API returns a token URL similar to the following:
"openvpn://import-profile/https://192.0.2.2/rest/GetProfileViaToken?token=Q3nY2St5T9jMHUAcX9aDUPPvDIzamD6s"Open the URL on a device with OpenVPN Connect installed to automatically import the connection profile.
The imported profile type matches the option selected when generating the token URL.