Page 1 of 1

REST Tokens returns HTTP 401 Unauthorized

Posted: Wed Mar 06, 2019 4:44 pm
by piter197
Hi,

I try to follow this guide https://support.gpsgate.com/hc/en-us/articles/360008341874-Use-REST-API-for-getting-Events
I use Postman and RESTClient addon for Firefox but every time I try to login to get token, I always get error 401 Unauthorized.

Status Code: 401 Unauthorized
access-control-allow-headers: Content-Type, Authorization
access-control-allow-methods: GET,PUT,POST,DELETE,PATCH,OPTIONS
access-control-allow-origin: *
content-type: application/json; charset=utf-8
date: Wed, 06 Mar 2019 15:38:07 GMT
server: Microsoft-HTTPAPI/2.0
transfer-encoding: chunked

If I try this using HTTP client fromGpsGate http://host_name/comGpsGate/api/v.1/test it always success to get token response.

Please help me and thank you in advance.

Re: REST Tokens returns HTTP 401 Unauthorized

Posted: Wed Mar 06, 2019 5:00 pm
by reza_khamooshi
Please make sure you have enabled “_APIRead” privilege both in site-admin and the application your user belongs to. Please send an email to support@gpsgate.com if it does not fix the issue.

Re: REST Tokens returns HTTP 401 Unauthorized

Posted: Wed Mar 06, 2019 5:02 pm
by piter197
I have double check that the user login have "_APIRead" privilege.

I use Postman and RESTClient addon for Firefox and always get error 401 Unauthorized. But If I try this using HTTP client fromGpsGate http://host_name/comGpsGate/api/v.1/test it always success to get token response.

Re: REST Tokens returns HTTP 401 Unauthorized

Posted: Sat Mar 09, 2019 1:55 pm
by reza_khamooshi
Please make sure that you send "Content-Type:application/json" header with your request.

Re: REST Tokens returns HTTP 401 Unauthorized

Posted: Mon Mar 11, 2019 2:14 pm
by piter197
It works. Thank you.