OAuth token request returns 403

jyuanjyuan Posts: 7Member
I registered my app and got the clientId and the secret.   I am using spring oauth client to do the token request and I can see the request is formed perfectly.  It has the right code (the temp code issued after authorization from the user input). I see the request sent but the response is a 403. No specific reason in the body, just a generic ‘not authorized’.  

I am requesting a read sale scope.  From the documents it seems to be one of the least privileged scope.  

Can I get some tips on other things to try and debug?  

3 comments

  • Adrian SamuelAdrian Samuel Posts: 472Moderator, Lightspeed Staff moderator
    @jyuan did you receive an email saying your API client was approved?

    Adrian Samuel

    API Integrations Consultant - Strategic Solutions

    Lightspeed HQ

  • jyuanjyuan Posts: 7Member
    Yes I have the confirmation email about the API client was approved.

    I can also confirm that using POSTMAN I am able to get a key.  But the mystery is why in the code I can't get past the 403.  Everything from content-type looks correct to me.

    Here is what the request object looks like:
    {   grant_type=[authorization_code], 
        code=[54d2d8d7737e1a6238655dc87b2224ffeb3f22a9], 
        client_id=[112233], client_secret=[445566]},
        {   Accept=[application/json;charset=UTF-8], 
            Content-Type=[application/x-www-form-urlencoded;charset=UTF-8]}>
  • jyuanjyuan Posts: 7Member
    Ok so I tracked it down to this, Certain UserAgents are not accepted by your site, code was adding this in the header:UserAgent: Java/1.8.0_72
    and it fails.  

    Why is this UserAgent not acceptable?


Sign In or Register to comment.