1

Access Denied (Error code 7) - access level 0x800

Тема: Access Denied (Error code 7) - access level 0x800

I need to bind/unbind trailers through Javascript code, but if I use "&access_type=" + 0x800 in stead of 0x100, I can't log in and get error code 7 (Access Denied):

var url = dns + "/login.html";  // Tyretrack site DNS + "/login.html"
    url += "?client_id=" + "App";    // Tyretrack application name
    url += "&access_type=" + 0x800;    // access level, 0x800 = "Edit sensitive data"
    url += "&activation_time=" + 0;   
    url += "&duration=" + 604800;   
    url += "&flags=" + 0x1;           
    url += "&redirect_uri=" + dns + "/post_token.html";

When logging in with 0x100, I can log in fine.  Could you please assist?

2

Access Denied (Error code 7) - access level 0x800

Re: Access Denied (Error code 7) - access level 0x800

Try to set access_type=0x900 (0x100 + 0x800)

-------------------------

I cant get why do you need to open this login form code, it's wrong way to use it?

Right way is to
- open /login form in browser with all needed params
- enter login/password and get token
- use token in all your app, integrations or whatever

If you want to get "forever" token - just add &duration=0 parameter to login.html page.

3

Access Denied (Error code 7) - access level 0x800

(21/09/2020 11:42:34 отредактировано tyretrack)

Re: Access Denied (Error code 7) - access level 0x800

Brilliant! It works!

Regarding the login, I think the way you suggesting is the way I am doing it?? Please see the attached js file (functions getToken and tokenReceived).  I am an old-school C# desktop programmer with a little bit of JS background and very new to “web” programming, so I am closely following the sample code in the playground at the moment. ANY comments/critisism on my code will be very much appreciated! Just a bit of background on what I am trying to achieve.  Our cutomers use GPS devices with TPMS sensors on both their trucks and trailers, so for each trailer we have to create a Unit as well, with the same name as the Trailer to make use of the binding feature. Our customers are only interested in the pressures on each of their tyres on their trucks and trailers (www.tyrecare.co.za/TTMS)

Also, I am struggling a bit as to when and how often I should call the updateDataFlags and the loadLibrary. Can I do this once or should I do so it as I need the data?

As said earlier any guidance will be welcome!

Thanks in advance!

  • Access Denied (Error code 7) - access level 0x800
Опубликовать вложения

Иконка вложений tyretrack.js 35.79 Кб, файл был скачан 218 раз(а) 

4

Access Denied (Error code 7) - access level 0x800

Re: Access Denied (Error code 7) - access level 0x800

Regarding the login, I think the way you suggesting is the way I am doing it??

If you use code to construct login form URL - it's absolutely ok! Sorry for confusing

Also, I am struggling a bit as to when and how often I should call the updateDataFlags and the loadLibrary. Can I do this once or should I do so it as I need the data?

Simple rule - run it once after login. When you call updateDataFlags all data come to your page and updates automatically. After updateDataFlags you can use wialon.core.Session.getInstance().getItems('avl_unit') without request to wialon

5

Access Denied (Error code 7) - access level 0x800

Re: Access Denied (Error code 7) - access level 0x800

Thank you Shmi.