Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

error regarding the "errorType":"invalid_client"

hi guys,

 

this is my code

 

session = request.session
  service = OAuth2Service(
           client_id='********',
           client_secret='---------------------------------------------------',
           access_token_url='https://api.fitbit.com/oauth2/token',
           authorize_url='"https://www.fitbit.com/oauth2/authorize"',
           base_url='https://fitbit.com/api/')  

  params = {'redirect_uri': 'http://127.0.0.1:8000/',
          'response_type': 'code'}
  url = service.get_authorize_url(**params)

  data = {'code': 'response_type',
        'grant_type': 'authorization_code',
        'redirect_uri': 'http://127.0.0.1:8000/'}

  session = service.get_auth_session(data=data)

 

Screenshot from 2018-03-05 16-23-17.png

Best Answer
0 Votes
3 REPLIES 3

Guys any suggestions pls

Best Answer
0 Votes

guys please, I am really sticked here and unable to move farther

Best Answer
0 Votes

Hi @access24,

 

My apologies for the delay with getting back to you.  I'm having a hard time following your code.  But, the error message states you're not providing a header with the authorization request.  Once you receive the authorization code and you're requesting the access token/refresh token pair, you need to specify the following authorization header with the /oauth2/token endpoint.

 

"Authorization: Basic <Base64 encoded string of your application's client id:secret>"

 

Information on requesting the access token can be found in the document.  Also, I'd recommend trying the OAuth 2.0 Tutorial tool which can be found at the bottom of your application settings on the dev.fitbit.com web site.  This tool will show you what information needs to be presented within your code.

 

OAuth 2.0 Tutorial - Access Point.png 

Gordon Crenshaw
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google
Best Answer
0 Votes