k33g / gh3

Client-side Javascript API wrapper for GitHub API V3
370 stars 79 forks source link

Authentication #5

Closed billybonks closed 11 years ago

billybonks commented 11 years ago

Hi i cant seem to see any details if i wanted to authenticate to github, i suppose this functionality is not yet implemented

k33g commented 11 years ago

I'm not sure this is useful client side (private repositories ?), but you may find of interest in this : https://github.com/ajaxorg/node-github#authentication

billybonks commented 11 years ago

the main use that comes to mind is increasing your rate limit from 60 per hour to 5000 per hour

from git hub :

We limit requests to 60 per hour for unauthenticated requests. For requests using Basic Authentication or OAuth, we limit requests to 5,000 per hour. You can check the returned HTTP headers of any API request to see your current status:

k33g commented 11 years ago

Ok, i see, but i don't think it's possible todo only with client-side, you need a server side script (or in an application) to get a token : http://blog.vjeux.com/category/javascript

i've tried with basic authentication with something like that :

Gh3.Helper.callHttpApi({
    beforeSend: function (xhr) { xhr.setRequestHeader ("Authorization", "Basic " + Gh3.Base64.encode("user:password")); },
    success : function(res){ console.log("SUCCESS",res)}
})

but it does'nt work

billybonks commented 11 years ago

i see :/ i think im going to have to redo most of my code in a server side code that generates the pages. because 60 is just to low :)