javascriptdribbble-api

Dribbble api version 2


I've used the v1 of the Dribbble's API to show all my shots on my portfolio page. It requires the Client Access Token and nothing more. A few days ago I updated Client Access Token and got the error which says that v1 API is deprecated and I must use the v2. I read the documentaion and didn't find any approaches to use the API without OAuth 2.

Is it possible to use updated Dribbble's API without OAuth 2? According to the docs I can't show shots in my portfolio as I did before.


Solution

  • You will need to use OAuth and if you notice v1 will be deprecated come March 2018. At first I was somewhat confused by v2 documentation in obtaining an access token but after spending a little time experimenting I was able to figure out how to get an access token.

    First you will need to Register Application. Do note what you put in the Callback URL because it's important later.

    For example, my callback url is http://grim.com

    Referencing OAuth on my Mac in the terminal I ran a curl:

    curl GET https://dribbble.com/oauth/authorize?client_id=CLIENT_ID_FROM_APPLICATION
    

    After running the curl I copied the link returned from the response and ran open URL which in the browser I was prompted a sign in. After sign in I was asked if I wanted accept, then I was redirected to the Callback URL. In the browser copy the last part of the code from the redirect, the URL will look like this:

    http://grim.com?code=sadhjsahdjksahdjsahdjsahdkjsa
    

    After copying the code (?code=sadhjsahdjksahdjsahdjsahdkjsa) I opened Postman and changed it to Post from Get.

    I passed:

    https://dribbble.com/oauth/token?client_id=CLIENT_ID&client_secret=CLIENT_SECRET&code=sadhjsahdjksahdjsahdjsahdkjsa
    

    I was returned:

    {
        "access_token":"1323213h23h2131j2h3jk12",
        "token_type":"bearer",
        "scope":"public",
        "created_at":13211421
    }
    

    Using the token in the terminal we can do:

    curl "https://api.dribbble.com/v2/user?access_token=1323213h23h2131j2h3jk12"
    

    and a return of the user should be in the terminal. There might be a better solution out there but hope this helps.