We are in the process of migrating this forum. A new space will be available soon. We are sorry for the inconvenience.

Get the Access Token

07-04-2014, 03:28 PM

In the HTTP Header 'Authorization: Basic', you need to provide your credentials.

In this case, we are waiting a base64 encoded of your credentials, separated by ':'.

If your application key = "toto" and your application secret is "tata", then your Basic authentication is base64("toto:tata").

The final HTTP header looks like that : 'Authorization' : 'Basic dG90bzp0YXRh'

07-02-2014, 11:14 PM
Hi everyone,

I have a little problem to get an access token in python.

Here is my test :

    s = requests.session()

    print "https://api.hubic.com/oauth/auth/?scope=usage.r%2Caccount.r%2CgetAllLinks.r%2Ccredentials.r%2Cactivate.w%2Clinks.drw&redirect_uri=http%3A%2F%2Flocalhost%2F&response_type=code&client_id=api_hubic_***********"

    code = raw_input("Please enter the code : ")
    print code

    headers = {'content-type': 'application/x-www-form-urlencoded', 'Authorization': 'Basic'}
    params = {'code':code, 'redirect_uri':redirect_uri, 'grant_type':'authorization_code'}
    r = s.post("https://api.hubic.com/oauth/token/ HTTP/1.1", params=params, headers=headers)
    print r.text
The Authorization code is ok, but for the second part, I always get this json:

{"error_description":"missing arguments","error":"invalid_request"}
I use the requests lib, do you have an idea ?

Thank you in advance for your help,