Any Authentication tutorial on Python?

weemo33weemo33 Posts: 7Member
are there any tutorials (complete) for the authentication part using Python?


Thanks

11 comments

  • weemo33weemo33 Posts: 7Member
    I follow the documentation on here and I get this error

    "error":"invalid_grant","error_description":"Authorization code doesn't exist or is invalid for the client"
  • jamesratcliffejamesratcliffe Posts: 160Administrator, Lightspeed Staff moderator
    Hi,

    At the moment all we have is the sample code in the authorization guide. We may add a sample python temporary token endpoint in the future, but it's significantly more complicated than with PHP. We would have to choose a specific web framework, and some of the code would be specific to that framework.
    James Ratcliffe
    API Integrations Specialist
    Lightspeed HQ
  • weemo33weemo33 Posts: 7Member
    What are the grant types available? I have tried bearer, and authorization_code but none seem to do the trick. I am pretty sure I have the code right and it seems to point to the grant_type problem.

    Thanks
  • jamesratcliffejamesratcliffe Posts: 160Administrator, Lightspeed Staff moderator
    Hi again.

    This error, ""Authorization code doesn't exist or is invalid for the client", usually means that more than 30 seconds have passed since you received the temporary token.

    It can also mean that the client ID used in the POST request doesn't match the client ID used to request access (in the first step).
    James Ratcliffe
    API Integrations Specialist
    Lightspeed HQ
  • jamesratcliffejamesratcliffe Posts: 160Administrator, Lightspeed Staff moderator
    The grant_type is authorization_code.
    James Ratcliffe
    API Integrations Specialist
    Lightspeed HQ
  • weemo33weemo33 Posts: 7Member
    So I was able to piece things together on this and I was able to get the token. I have a few questions here after:

    1. do I refresh the token the same way I requested one?
    2. in the examples on the website, I keep seeing {AccoundID}
    Is {AccountID} given or is it the same as Client_ID?

    thx
  • jamesratcliffejamesratcliffe Posts: 160Administrator, Lightspeed Staff moderator
    James Ratcliffe
    API Integrations Specialist
    Lightspeed HQ
  • weemo33weemo33 Posts: 7Member
    Got it, thanks.
  • jamesratcliffejamesratcliffe Posts: 160Administrator, Lightspeed Staff moderator
    No problem.
    James Ratcliffe
    API Integrations Specialist
    Lightspeed HQ
  • aorzhaorzh Posts: 5Member
    edited June 2018
    weemo33 said:
    Got it, thanks.
    @weemo33 Can you share your experience?
    Post edited by jamesratcliffe on
  • weemo33weemo33 Posts: 7Member

    Just noticed this message. I was able to do a connection and pull records from Lightspeed. I did this back in October of 2018, I did not work more on it. I just had too many questions before proceeding so I left it in the backburner.

Sign In or Register to comment.