How do I get Access Token

lakhlakh Member Posts: 2
I went through the Authorization process and I got access code, but how do I get Access Token because part of the payload is field called "grant_type" and what do I put in that field?

3 comments

  • Adrian SamuelAdrian Samuel Moderator, Lightspeed Staff Posts: 654 moderator
    Hey @lakh you need to put:
    'grant_type=authorization_code'
    You can read more about about this here: 

    https://developers.lightspeedhq.com/retail/authentication/access-token/

    Hope this helps! :)



    Adrian Samuel

    Software Developer

    Lightspeed HQ

  • lakhlakh Member Posts: 2
    What is <table><tbody><tr><td>grant_type</td><td>Specify ‘authorization_code’ to get the access token.</td></tr></tbody></table>

    When you have a temporary token it can be converted to an access token by passing your client ID, client secret and the temporary token to the access_token endpoint. If the combination of client ID and temporary token are recognized, and the token is still valid, then a JSON response will be returned with the access token and the permissions that granted to the access token.

    You must request access tokens with a POST request so that your client_secret and code are encrypted; GET parameters can be visible to users in some situations. The fields must be sent as multi-part form data in the body of the POST request (the Content-Type must be ‘multipart/form-data’).

    The request to convert the temporary token to an access token should be made out of band to prevent visibility of your client secret.

    The access token request endpoint is:

    https://cloud.lightspeedapp.com/oauth/access_token.php

    Below are the fields used in the payload sent to the access token end point:

    ParameterDescription
    client_idYour application’s client ID specified when you registered your client.
    client_secretThe client secret you specified when you registered your client.
    codeThe code you received after the user authorized your application.
    grant_typeSpecify ‘authorization_code’ to get the access token.

  • Adrian SamuelAdrian Samuel Moderator, Lightspeed Staff Posts: 654 moderator
    Hey @lakh I couldn't tell if you had a question embedded in what you sent there...

    Just to be clear, the grant-type value just specifies the correct headers that need to be set for the access token request

    Adrian Samuel

    Software Developer

    Lightspeed HQ

Sign In or Register to comment.