This is a migrated thread and some comments may be shown as answers.

REST API Log in using access_token?

1 Answer 50 Views
REST API
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Bruce
Top achievements
Rank 1
Bruce asked on 06 Feb 2016, 04:46 PM

All,

I have the Login code working, and if successful, I store the access_token in local storage. I was wondering if there is a way using the REST API to log in a user using the stored access_token. I want to allow the user to go straight through to the app if their token hasn't expired, and take them to the login page if it has, and I don't want to store their credentials.

Thanks,

Brruce

1 Answer, 1 is accepted

Sort by
0
Anton Dobrev
Telerik team
answered on 09 Feb 2016, 02:18 PM
Hi Bruce,

To check whether the user is logged in use the /me endpoint before any business critical app request:

You can reuse the access token you have locally when making the requests to the REST API. Just assign it to an Authorization header:
Authorization: "bearer " + localStorage.getItem(accessTokenKeyName);

I hope that this helps.

Regards,
Anton Dobrev
Telerik
 
Everlive is now Telerik Backend Services, and is part of the Telerik Platform.
 
Tags
REST API
Asked by
Bruce
Top achievements
Rank 1
Answers by
Anton Dobrev
Telerik team
Share this question
or