Showing results for 
Search instead for 
Did you mean: 

Unable to get a token from Rest API

New Contributor

Unable to get a token from Rest API

I'm not if this is the correct group but still needed help so posting here.


I'm trying to integrate pulse secure API as per this documentation:


and getting an empty response using python and 403 using curl command mentioned in the API.


I've check the REST API settings and the user created is admin. Is there something I'm missing out or going wrong somewhere?


If anyone can guide, it will be really helpful for me.


Thank you

New Contributor

Re: Unable to get a token from Rest API

It could an issue with the HTTP Authentication or maybe the content-type header.  Could you post the curl command you used to test the authentication? It would look something like this:


curl --user apiusername:apipassword --header "Content-Type: application/json" \
--noproxy "*" \


I added the --noproxy "*" to make sure the request doesn't go to the proxy server defined in the HTTP_PROXY environment variable.


Re: Unable to get a token from Rest API

Configured admin account was enabled to use REST API access, correct? API AUTH request being done against which IP address of the VPN server? It should be either internal or Management port.


Does the AUTH request include the Authorization header with value "Basic <base64 encoded user: pass>" ?



Below is the powershell script that I am using to get the API key:


$response variable holds the API key value.


$username = Read-Host “Enter PCS username: “
$password = Read-Host “Enter PCS password: “
$userpass  = $username + “:” + $password
$bytes= [System.Text.Encoding]::UTF8.GetBytes($userpass)
$authheader = "Basic " + $encodedlogin
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$uri = "https://<VPN>/api/v1/auth"
$response = Invoke-RestMethod -Uri $uri -Headers $headers -Method Get


PCS Expert
Pulse Connect Secure Certified Expert

Re: Unable to get a token from Rest API

Sorry, but this commands generate  error 403

I could use RESTAPI via Browser (to test), curl and in python, but not in powershell


I try several different scripts in powershell
any hint to use rest API with powershell


Regards mephisto