Share user token with my external application

Hi,

i need to user Backendless for user managment registration and login
(and all others user operations).

I want use the user token also in my external application
to recognize the user.

How can I do it ?

Hi Andrea,

Are you asking how to obtain a user token?

Regards,
Mark

Yes,

i’m sorry for my english :slight_smile:

I attach a file about my architecture

Regards,

Andrea

Hi Andrea,

Thanks for the diagram, it is very useful.

User token is only helpful if you need to communicate with Backendless backend on behalf of the user, that is to maintain the user identify so you can apply security permissions on the backend.

If your goal is just to get the user information to the API manager, it would be sufficient to send there User’s objectId. Once API Manager has objectId, it can use Backendless API to retrieve that user from the server.

I hope this helps, if not, please do not hesitate to ask.

Regards,
Mark

Hi Mark,

Thanks very much.

Then I can save user token in my external application or use the objectid

Regards,

Andrea

Hi Andrea,

I just wanted to make sure I answered your question… Do you have an idea how to move forward?

Regards,
Mark

Hi Mark,

after backendless registration, I store ocjectid in my application (my database).
Then site/mobile app call my application send objectid

Regards,

Andrea

Hi Mark,

I want to know how to get user token and store it to localstorage.
I am using Ionic2 with backendless’s REST API .
Below my user_service.js


userLogin(userData) 
    {
        let body = JSON.stringify({ login: userData.email, password: userData.password });
        let headers = new Headers(this.Backend_Header);
        let options = new RequestOptions({ headers: headers });
        return this.http.post(this.Backend_Login_Url, body, options)
            .map( (res) => {
                      let data = res.json();
                      console.log('objectId at user_service', data.objectId);  // result : C8FE36A2-9396-13C5-FF9C-8F8EF7F07900
                      console.log('data.token at user_service', data.token);  // result :  undefined
                      console.log('data.token at user_service', data.user-token); // result : EXCEPTION: ReferenceError: token is not defined.
});

my response after successfull login

Object {lastLogin: 1463661780690, created: 1456890510000, name: "sample", ___class: "Users", user-token: "D9F847FE-C016-49CB-FF44-D030AF2E0400"…}
<ol>___class:"Users"
__meta:"{"relationRemovalIds":{},"selectedProperties":["__updated__meta","password","created","name","___class","ownerId","updated","objectId","email"],"relatedObjects":{}}"
created:1456890510000
email:"sample@gmail.com"
lastLogin:1463661780690
name:"sample"
objectId:"C8FE36A2-9396-13C5-FF9C-8F8EF7F07900"
ownerId:null
updated:null
user-token:"D9F847FE-C016-49CB-FF44-D030AF2E0400"
__proto__:Object


</ol>

Thanks in advance.