piter197
Posts: 830
Joined: Sun Jan 09, 2011 3:32 am

REST Tokens returns HTTP 401 Unauthorized

Wed Mar 06, 2019 4:44 pm

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.
Best Regards,
piter197

User avatar
reza_khamooshi
GpsGate
Posts: 12
Joined: Mon Mar 14, 2016 7:29 pm
Location: Sweden
Contact: Website

Re: REST Tokens returns HTTP 401 Unauthorized

Wed Mar 06, 2019 5:00 pm

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.

piter197
Posts: 830
Joined: Sun Jan 09, 2011 3:32 am

Re: REST Tokens returns HTTP 401 Unauthorized

Wed Mar 06, 2019 5:02 pm

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.
Best Regards,
piter197

User avatar
reza_khamooshi
GpsGate
Posts: 12
Joined: Mon Mar 14, 2016 7:29 pm
Location: Sweden
Contact: Website

Re: REST Tokens returns HTTP 401 Unauthorized

Sat Mar 09, 2019 1:55 pm

Please make sure that you send "Content-Type:application/json" header with your request.

piter197
Posts: 830
Joined: Sun Jan 09, 2011 3:32 am

Re: REST Tokens returns HTTP 401 Unauthorized

Mon Mar 11, 2019 2:14 pm

It works. Thank you.
Best Regards,
piter197

Return to “GpsGate for Developers”