REST API Log in using access_token?

2 posts, 0 answers
  1. Bruce
    Bruce avatar
    6 posts
    Member since:
    Jan 2016

    Posted 06 Feb 2016 Link to this post


    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.



  2. Anton Dobrev
    Anton Dobrev avatar
    604 posts

    Posted 09 Feb 2016 Link to this post

    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.

    Anton Dobrev
    Everlive is now Telerik Backend Services, and is part of the Telerik Platform.
Back to Top