New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

401 Error on API Calls #18

Closed
johnchourajr opened this Issue Apr 6, 2018 · 13 comments

Comments

Projects
None yet
3 participants
@johnchourajr
Copy link

johnchourajr commented Apr 6, 2018

All example plus my own uses of Jribbble have stopped working.

I can see there is a 401 bad_credentials error in the console

GET https://api.dribbble.com/v1/users/johnchourajr 401 ()
GET https://api.dribbble.com/v1/users/johnchourajr/shots/?per_page=12 401 ()

Here is my example: https://codepen.io/jchoura/pen/vgOXpa?editors=0010

@johnchourajr

This comment has been minimized.

Copy link

johnchourajr commented Apr 6, 2018

Did more digging and it looks like Dribbble shut down the v1 api on monday https://twitter.com/DribbbleSupport/status/981543717088579584

@tylergaw

This comment has been minimized.

Copy link
Owner

tylergaw commented Apr 6, 2018

Thanks @johnchourajr yep, v1 shut down and v2 requires Oauth access_token for requests now. They also removed a large bit of functionality.

I'm working on a 3.0 #17 and I'm also building a site to help folks generate their Oauth access tokens.

I chatted a bit with Dribbble here https://twitter.com/tylergaw/status/951438840299958275

and another Jribbble user here https://twitter.com/heymagruder/status/980912071314497536

My updates will be ready to go today. Will def be helpful to have folks test it out when it's ready. I'll ping you.

@tylergaw tylergaw added the In progress label Apr 6, 2018

@tylergaw tylergaw referenced this issue Apr 6, 2018

Merged

Jribbble 3.0 #17

@tylergaw tylergaw self-assigned this Apr 6, 2018

@tylergaw

This comment has been minimized.

Copy link
Owner

tylergaw commented Apr 6, 2018

Hey again @johnchourajr OK, I have a beta release of Jribbble 3.0 ready. And more important I think, I guide for the Oauth setup process here:

Minified version of 3.0 https://github.com/tylergaw/jribbble/blob/3.0.0-beta.1/dist/jribbble.min.js
Guide https://jribbble.glitch.me/

I'm still working on finishing the release and getting full documentation and examples, but if you get a moment could go through the process and see what works for you and doesn't? That would help a lot, thank you.

@heymagruder

This comment has been minimized.

Copy link

heymagruder commented Apr 7, 2018

Tested this morning and I'm getting the following errors:

VM2628 jribbble.min.js:7
Uncaught ReferenceError: jQuery is not defined
at VM2628 jribbble.min.js:7

(anonymous)
@
VM2628 jribbble.min.js:7

VM2632 jquery.min.js:4
GET https://api.dribbble.com/v1/users/magruder/shots/?per_page=12 401 ()

send
@
VM2632 jquery.min.js:4

ajax
@
VM2632 jquery.min.js:4

t.get
@
jribbble.min.js:7

(anonymous)
@
jribbble.min.js:7

setTimeout (async)

(anonymous)
@
jribbble.min.js:7

e.jribbble.users
@
jribbble.min.js:7

(anonymous)
@
(index):281

@tylergaw

This comment has been minimized.

Copy link
Owner

tylergaw commented Apr 8, 2018

Thanks @heymagruder Looks like you might still have a 2.x version of Jribbble since the URL it's hitting for the Dribbble api is v1. I don't have the new 3.x version download locations documented fully yet.

The new 3.x is in a tag here https://github.com/tylergaw/jribbble/tree/3.0.0-beta.1/dist

It's also available in the glitch at https://jribbble.glitch.me/jribbble.min.js

@johnchourajr

This comment has been minimized.

Copy link

johnchourajr commented Apr 8, 2018

@tylergaw you're the best, it worked like a charm. 🙌

@tylergaw

This comment has been minimized.

Copy link
Owner

tylergaw commented Apr 9, 2018

Thanks for the testing and feedback @johnchourajr and @heymagruder. Finished the docs, added tests, and did a proper 3.0 release here https://github.com/tylergaw/jribbble/releases/tag/3.0.0

@heymagruder

This comment has been minimized.

Copy link

heymagruder commented Apr 10, 2018

Updated to 3.x but I'm still getting an issue:
(index):279 Uncaught TypeError: Cannot read property 'setToken' of undefined
at (index):279
(anonymous) @ (index):279

@tylergaw

This comment has been minimized.

Copy link
Owner

tylergaw commented Apr 10, 2018

Hrm, @heymagruder are you able to show either the code live somewhere or maybe a codepen or just a full example here so I can have a closer look?

@heymagruder

This comment has been minimized.

Copy link

heymagruder commented Apr 11, 2018

Sure @tylergaw check out http://cmagruder.me/ "See what I'm working on right now."

@tylergaw

This comment has been minimized.

Copy link
Owner

tylergaw commented Apr 11, 2018

OK, thanks @heymagruder I see what's happening now. Jribbble 3.0 is a rewrite, so a couple things are different in how you use it now.

  • It no longer requires jQuery, so it doesn't exist on the $ object like $.jribbble
  • It's api has changed a bit, it's no longer promise-based

There are updated docs and examples in the readme https://github.com/tylergaw/jribbble#using-jribbble Here's a snippet for for your use case:

jribbble.setToken("<your_token");
jribbble.shots({per_page: 12}, function(shots) {
  var html = [];
  
  shots.forEach(function(shot) {
    html.push('<li class="shots--shot">');
    html.push('<img src="' + shot.images.normal + '">');
    html.push('</a></li>');
  });
  
  $('.shots').html(html.join(''));
});

If you wanted to, you could also set your access token as an option of the call to shots, but that's not required. Both ways are documented here https://github.com/tylergaw/jribbble#setting-your-access-token

@heymagruder

This comment has been minimized.

Copy link

heymagruder commented Apr 12, 2018

@tylergaw That worked! Thanks for all the help. And for putting in the time to get this back up and running again.
If you ever need help with anything down the road just reach out. I owe ya one.

@tylergaw

This comment has been minimized.

Copy link
Owner

tylergaw commented Apr 12, 2018

Excellent! Glad I could help out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment