Invalid Access Token after receiving it and request for another response on different endpoints.

arvindeveloperarvindeveloper Posts: 10Member
edited October 2018 in Development
I'm trying to retrieve customers from the api using the access token and accountId I received from the Account endpoint. However the api returned an Invalid Access Token even though I used the same token from the Account. I first used scope employee:all then I added employee:customers but both returned Invalid AccessToken. Any ideas?

[PICTURES REMOVED - Sensitive Account Data]
Post edited by Adrian Samuel on
Tags:

4 comments

  • Adrian SamuelAdrian Samuel Posts: 521Moderator, Lightspeed Staff moderator
    @arvindeveloper the Account endpoint doesn't return the Access token, just the AccountId.

    The access token is retrieved by getting the temporary token that's sent to the callback url that you listed upon registration. You use your secret key and client ID (also given upon registration) and then you receive your access token

    More about this process can be read here:
    https://developers.lightspeedhq.com/retail/authentication/access-token/

    Adrian Samuel

    API Integrations Consultant - Strategic Solutions

    Lightspeed HQ

  • arvindeveloperarvindeveloper Posts: 10Member
    edited October 2018
    Hi @Adrian Samuel

    My mistake, I didn't mean that I retrieved the access token from Account endpoint. I used the url for retrieving access token which is "https://cloud.lightspeedapp.com/oauth/access_token.php". Then, after I received the access token I used it on as "Authorisation: Bearer {accessToken}" on header and requested for accounts on Account endpoint. I retrieved all accounts successfully but when I used the same token together with the accountId I received from account endpoint to retrieve customers it return "Invalid Access Token" same on the second image I attached from my post.
  • Adrian SamuelAdrian Samuel Posts: 521Moderator, Lightspeed Staff moderator
    edited October 2018
    Heyy @arvindeveloper, interesting, have you tried to refresh your token and then make request to the customerType endpoint?

    Also, could you please private message me your refresh token so I can test for you to troubleshoot

    Adrian Samuel

    API Integrations Consultant - Strategic Solutions

    Lightspeed HQ

  • Lacookie Denise JonesLacookie Denise Jones Posts: 1Member

    I cant even get none of my call backs invalid access tokens always pop up

Sign In or Register to comment.