51

Discussion of new authorization method (oAuth)

Re: Discussion of new authorization method (oAuth)

We don't use phonegap in our development. That's why we can't be very helpfull to you in phonegap specific details.
Please refer to our playground examples about tokens http://sdk.wialon.com/playground.
Also this page http://phonegap-tips.com/articles/googl … owser.html can be helpfull to You.

Head of Wialon Local Department
Gurtam
52

Discussion of new authorization method (oAuth)

Re: Discussion of new authorization method (oAuth)

thanks for information. Another question i have :
How to change the wialon hosting image on login page when calling login.html page from javascript.

thanks & regards,
Vinod Porwal.

53

Discussion of new authorization method (oAuth)

Re: Discussion of new authorization method (oAuth)

vinod.porwal, logo image for login.html or login_simple.html is taken from site's skin (personal design).
You can ask your personal manager about it.

Head of Wialon Local Department
Gurtam
54

Discussion of new authorization method (oAuth)

Re: Discussion of new authorization method (oAuth)

Hi,
I am first time Wialon user, so please bear with me for some basic questions.

I am developing a simple android app.
The app is going to run a background job/service. The background job post the location details details to Wialon. The app does not have UI to use wialon login.html
I would like to know the step by step API sequence to token,authorize, login, create the device in Wialon and update the latest location against the device. In the Wialon documentation the new way to authorize is first returning me a html page with sign when i use the below sample url: http://hosting.wialon.com/login.html?cl … ion=604800
As i do not have a UI in my app, i would like to avoid or ignore the html.
Step 1:
Can anyone help how to perform the  token,authorize, login?
Step 2:
Help with using a Wialon item or Unit, i am not sure about the difference and i am noure if i need to use them. As per my requirement, i need to post the device id, location and when there is a location update i need to send and update the location against the device.

Kindly help me out here. Thanks in Advance.

Thank you,
Jagan

55

Discussion of new authorization method (oAuth)

Re: Discussion of new authorization method (oAuth)

Hi,
I am first time Wialon user, so please bear with me for some basic questions.
I am developing a simple android app.
The app is going to run a background job/service. The background job post the location details details to Wialon. The app does not have UI to use wialon login.html
I would like to know the step by step API sequence to token,authorize, login, create the device in Wialon and update the latest location against the device. In the Wialon documentation the new way to authorize is first returning me a html page with sign when i use the below sample url: http://hosting.wialon.com/login.html?cl … ion=604800
As i do not have a UI in my app, i would like to avoid or ignore the html.
Step 1:
Can anyone help how to perform the  token,authorize, login?
Step 2:
Help with using a Wialon item or Unit, i am not sure about the difference and i am noure if i need to use them. As per my requirement, i need to post the device id, location and when there is a location update i need to send and update the location against the device.
Kindly help me out here. Thanks in Advance.
Thank you,
Jagan

56

Discussion of new authorization method (oAuth)

Re: Discussion of new authorization method (oAuth)

Hello, jaganls.

If You can't use our oAuth form in Your app - you can authorize to Wialon using previously created infinite token with request http://sdk.wialon.com/wiki/en/sidebar/r … ples/login
You can create such token for Your user manually by using our oAuth form:

http://hosting.wialon.com/login.html?client_id=wialon&access_type=-1&activation_time=0&duration=0

where in client_id You can pass app name,
access_type -1 means full access,
activation_time 0 means token will be active at once,
duration 0 - means infinite token, it will exist forever, but it will be deleted after 100 days of inactivity (no logins).

Then as a result of successful authorization You can copy Your token from browsers query string: parameter access_token.

Now You can use this token in Your app:

https://hst-api.wialon.com/wialon/ajax.html?svc=token/login&
    params={
        "token":"<your_token>"
    }

As a result of this request You'll get json with parameter "eid". This is session id (sid) which You should pass to all further requests.

Some info about Wialon items. Item is common name for several classes (user, resource, unit, group, route, retranslator).
You need to use Unit -  it's device (tracker, mobile).

More details about sending device's location in next post.

Head of Wialon Local Department
Gurtam
57

Discussion of new authorization method (oAuth)

Re: Discussion of new authorization method (oAuth)

Hi,

Thank you for the reply. I was able to successfully authorize, login, create unit and search items.
Now my requirement is update location every 5 minutes to the specific unit, can you help with a sample request to keep posting the location update to the unit?

Thank you in Advance.

Thank you,
Jagan

58

Discussion of new authorization method (oAuth)

Re: Discussion of new authorization method (oAuth)

jaganls, now You can send data messages with coordinates to Wialon Unit.

You can do it using Wialon IPS protocol (recommended) http://gurtam.com/en/gps_tracking/gps_h … ?id=96266.
Here You can find emulator and sources https://github.com/xHasKx/WialonIPSEmulator/wiki.

Another way - You can periodically execute import messages request (with file) http://sdk.wialon.com/wiki/en/sidebar/r … _messages.
More info about import/export in Wialon http://docs.wialon.com/en/hosting/user/msg/port.

By the way this forum thread is for discussion of new authorization method only.

Head of Wialon Local Department
Gurtam
59

Discussion of new authorization method (oAuth)

Re: Discussion of new authorization method (oAuth)

Dear partners
We are developing new Wialon based application. is it possible to use remote API "New Authorization"  in localhost or we have to use it on server?
since when we work on localhost after post the New Authorization the response redirect us to oauth.html that is not contained in our localhost!!
Please guide us in this case.

60

Discussion of new authorization method (oAuth)

Re: Discussion of new authorization method (oAuth)

Dear Support Team

Regarding our new application is it possible to put it on your servers? We need PHP, MySQL and Apach web server? We are no familiar to such things that if your partners put their applications on your servers or user their own server and only use remote API to communication with Wialon.
Our application has it's own DB for some functions that doesn't exist in Wialon and uses Wialon where there is a elememnt in Wialon we can use it via remote API.

61

Discussion of new authorization method (oAuth)

Re: Discussion of new authorization method (oAuth)

Another question:
As each user has it's own Access, Why we should define Token Flag again? if we request for eaxmple -1 Token Flag or an user that don't have such access what will happen? i mean which is in higher level, User access right or Token Flag? is it possible to request a Token with more Flags thatn user access rights?

62

Discussion of new authorization method (oAuth)

Re: Discussion of new authorization method (oAuth)

hhamedk, Hello.

1. To answer the first question we need more details. Do You use Wialon Hosting or Wialon Local? How did You organized application and access to Wialon? Concerning localhost - it is recommended to use remote server.
2. We don't provide web hosting for clients' apps for now. May be in future. But only with strong validation.
3. About token access rights. You can generate token with limited access, for example to pass to third parties. As for users' access rights and tokens' access rights - they work as intersection.It means that if user has higher level of access and token has lower - lower access rights will work. If token has higher access level and token lower - still lower access rights will work.

Head of Wialon Local Department
Gurtam
63

Discussion of new authorization method (oAuth)

Re: Discussion of new authorization method (oAuth)

Dear Deal

We are using WH
Would you please explain that how we should integrate our app with Wialon? for example we want to add our application in apps menu in monitoring panel, where we should host it? how we should link it to Wialon? Please explain these questions and explain the procedure.
My another question is that we want to check the list of access rights templates for example in user properties by Remote API, but we couldn't find the command for this case. Please explain how should we do it.

64

Discussion of new authorization method (oAuth)

(24/02/2016 18:36:27 отредактировано deal)

Re: Discussion of new authorization method (oAuth)

hhamedk, here is documentation about adding apps to Wialon http://docs.wialon.com/en/hosting/cms/apps/apps.
If something in docs is unclear - ask questions, we'll help.

As for Your second question It isn't quite clear what You want to do. Try to explain more detailed. Are You talking about access rights templates in items dialog http://docs.wialon.com/en/hosting/cms/rights/dialog?

By the way this forum thread is for new authorization method discussion. It is recommended to ask another questions in appropriate threads or create new ones.

Head of Wialon Local Department
Gurtam
65

Discussion of new authorization method (oAuth)

(25/02/2016 11:17:05 отредактировано hhamedk)

Re: Discussion of new authorization method (oAuth)

Dear support team
thanks for your suggestions. Is there any option for us to apply codes first in localhost for test purposes and then Wialon Server? as you wrote on your forum and weblog Auth method the only access right to methods is to apply codes only with a form located in wialon server. If no, please explain how we should put our form to your server?

66

Discussion of new authorization method (oAuth)

(25/02/2016 12:40:12 отредактировано deal)

Re: Discussion of new authorization method (oAuth)

hhamedk, look at this example http://sdk.wialon.com/playground/demo/app_auth_token and try to do smth like this.
As for testing in local network - You can but You should write http://localhost instead of localhost in redirect_uri param.

Head of Wialon Local Department
Gurtam
67

Discussion of new authorization method (oAuth)

(25/02/2016 15:35:59 отредактировано hhamedk)

Re: Discussion of new authorization method (oAuth)

deal пишет:

hhamedk, look at this example http://sdk.wialon.com/playground/demo/app_auth_token and try to do smth like this.
As for testing in local network - You can but You should write http://localhost instead of localhost in redirect_uri param.

Dear deal
We are working on PHP, the code we use is as below:

<?php
// Define URL where the form resides
$form_url = "http://hosting.wialon.com/login.html";

// This is the data to POST to the form. The KEY of the array is the name of the field. The value is the value posted.
$data_to_post = array();

$data_to_post['client_id'] = "Mission Management";
$data_to_post['access_type '] = "-1";
$data_to_post['activation_time'] = "0"; 
$data_to_post['duration'] = "2592000";
$data_to_post['lang'] =  "en";
$data_to_post['flags'] = "0";
$data_to_post['user'] = 'ss-developers';
$data_to_post['redirect_uri'] = 'http://localhost/mm/main.php';
$data_to_post['response_type'] = 'token';
$data_to_post['css_url'] = 'http://localhost/mm/style.css';


// Initialize cURL
$curl = curl_init();

// Set the options
curl_setopt($curl,CURLOPT_URL, $form_url);

// This sets the number of fields to post
curl_setopt($curl,CURLOPT_POST, sizeof($data_to_post));

// This is the fields to post in the form of an array.
curl_setopt($curl,CURLOPT_POSTFIELDS, $data_to_post);

//execute the post
$result = curl_exec($curl);

//print_r ($result);

//close the connection
curl_close($curl);

?>

we run this code on local host, the result is as attached screenshot "login.jpg" and after entering the username and password the result is as "error.jpg" attachment.

Please guide us, explain what's wrong.

  • Discussion of new authorization method (oAuth)
  • Discussion of new authorization method (oAuth)
68

Discussion of new authorization method (oAuth)

Re: Discussion of new authorization method (oAuth)

hhamedk, You use our oauth form in wrong way - it won't work.
Тry to show form in separate window, like here http://sdk.wialon.com/playground/demo/app_auth_token
or in iframe, like here http://sdk.wialon.com/playground/uQRYKW7y/4

Head of Wialon Local Department
Gurtam
69

Discussion of new authorization method (oAuth)

(14/04/2016 11:34:25 отредактировано hhamedk)

Re: Discussion of new authorization method (oAuth)

Hi everyone

We are working on WL regarding our project. i want to know is it possible to change login (login.html) page in our WL server?
We need to design another login page we think as we are using WL (not WH) it may possible.

My another question is about access types under authentication. We could use Geofence Image command (http://sdk.wialon.com/wiki/en/sidebar/r … zone_image) in API with a token of 0x400 access type but now we receive "error 7" response. Is there any change in access types of system?

70

Discussion of new authorization method (oAuth)

Re: Discussion of new authorization method (oAuth)

hhamedk пишет:

Hi everyone

We are working on WL regarding our project. i want to know is it possible to change login (login.html) page in our WL server?
We need to design another login page we think as we are using WL (not WH) it may possible.

sorry, in this topic just the authorization is discussed, if it's about white-labeling opportunities please contact your regional manager directly.

thanks.

Business Development Manager
Gurtam
71

Discussion of new authorization method (oAuth)

Re: Discussion of new authorization method (oAuth)

hhamedk пишет:

Hi everyone

My another question is about access types under authentication. We could use Geofence Image command (http://sdk.wialon.com/wiki/en/sidebar/r … zone_image) in API with a token of 0x400 access type but now we receive "error 7" response. Is there any change in access types of system?

There were no changes in access types. This request should work. Make sure your user has enough access rights to resource with geofence.

Head of Wialon Local Department
Gurtam
72

Discussion of new authorization method (oAuth)

(07/09/2016 16:59:13 отредактировано davis.tom)

Re: Discussion of new authorization method (oAuth)

I'm trying to create a new notification and I'm getting access denied(erro 7) error.

Url used to create token:

http://hosting.wialon.com/login.html?client_id=App&access_type=-1&activation_time=0&duration=604800

instead of -1 as access type I tried  0x800- modification of sensitive data too.

Call used to create sid(eid) from the above result:

https://hst-api.wialon.com/wialon/ajax.html?svc=token/login&params={ "token":TOKEN}

With the above sid, call used to create notification: 

https://hst-api.wialon.com/wialon/ajax.html?svc=resource/update_notification&params={"itemId":13935212, "id":0, "callMode":create, "n":name1, "txt":dect1, "ta":2016-02-10, "td":2016-02-14, "ma":0, "mmtd":2, "cdt":2, "mast":2, "mpst":2, "cp":2, "fl":0x1, "tz":0, "la":EN}&sid=SID

I tried to get the account information with the below call and same error.

https://hst-api.wialon.com/wialon/ajax.html?svc=account/get_account_data&params={"itemId":USERID,"type":1}&sid=SID

Any idea what I'm missing?

73

Discussion of new authorization method (oAuth)

Re: Discussion of new authorization method (oAuth)

davis.tom, itemId 13935212 - is Your user id?
To create notification You should pass there Your resource id.
The same for get_account_data request.

Head of Wialon Local Department
Gurtam
74

Discussion of new authorization method (oAuth)

(08/09/2016 08:05:08 отредактировано davis.tom)

Re: Discussion of new authorization method (oAuth)

deal пишет:

davis.tom, itemId 13935212 - is Your user id?
To create notification You should pass there Your resource id.
The same for get_account_data request.

Edit:

Thanks. Resource Id is "bact" parameter in svc=token/login call right? My value for "bact" is "13935213". I tried with it an now error 7 is gone. Got result for get_account_data call.

But now the error for resource/update_notification is error 4 with "bact" = "13935213". It looks like an issue unrelated to authorization. Will start a new thread and ask.

75

Discussion of new authorization method (oAuth)

Re: Discussion of new authorization method (oAuth)

URGENT ! OAuth error ?

Yesterday morning at around 10:35 am (Eastern Time), all our data acquisitions using the Wialon REST API stopped working.

It seems to be a problem with OAuth.

Calling the login method, passing one by one all the permanent tokens we had, returned the error code '4'.

I regenerated new permanent tokens for my users via this url: http://hosting.wialon.com/login.html?sv … vc_error=7

Yet, my calls to the login method of the REST API keep on failing with the error code '4'.

By the way, I did verify that application tokens do appear on the Wialon console, so that's why I think there was an update or something your side which broke the way OAuth was working.

Can you please help me to solve this ?

Our customers are no longer receiving their data since yesterday morning.

Thanks