-
-
Save IftekherSunny/28eaef648abd56966e87c5ccb50988a4 to your computer and use it in GitHub Desktop.
Some notes on how to authenticate with composer/satis against github oauth, so the rate limit of 60 will be raised op to 5000. Can also be used for travis-ci.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create a new Token | |
curl -u 'githubuser' -d '{"note":"Your Application"}' https://api.github.com/authorizations | |
# It is: "ebab4dc37e654bb230a9c69ebcd5f38e9a81e210" | |
#{ | |
# "created_at": "2013-01-04T18:00:28Z", | |
# "app": { | |
# "url": "http://developer.github.com/v3/oauth/#oauth-authorizations-api", | |
# "name": "Your Application (API)" | |
# }, | |
# "url": "https://api.github.com/authorizations/1047183", | |
# "token": "ebab4dc37e654bb230a9c69ebcd5f38e9a81e210", | |
# "updated_at": "2013-01-04T18:00:28Z", | |
# "scopes": [ | |
# ], | |
# "note": "Your Application", | |
# "id": 1047183, | |
# "note_url": null | |
#} | |
# Test token: | |
curl -I -H "Authorization: token ebab4dc37e654bb230a9c69ebcd5f38e9a81e210" https://api.github.com/rate_limit | |
#HTTP/1.1 200 OK | |
#Server: GitHub.com | |
#Date: Wed, 27 Nov 2013 17:45:59 GMT | |
#Content-Type: application/json; charset=utf-8 | |
#Status: 200 OK | |
#X-RateLimit-Limit: 5000 | |
#X-RateLimit-Remaining: 4935 | |
#X-RateLimit-Reset: 1385575867 | |
#Cache-Control: no-cache | |
#X-OAuth-Scopes: | |
#X-GitHub-Media-Type: github.beta | |
#X-Content-Type-Options: nosniff | |
#Content-Length: 291 | |
#Access-Control-Allow-Credentials: true | |
#Access-Control-Expose-Headers: ETag, Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, #X-Accepted-OAuth-Scopes | |
#Access-Control-Allow-Origin: * | |
#X-GitHub-Request-Id: 52534AB6:2640:3A6D6D7:52962FD7 | |
#Vary: Accept-Encoding | |
# Method 1: | |
# Add token to composer.json file | |
# This does not work for satis, but will work on Travis-Ci. | |
{ | |
"config":{ | |
"github-oauth":{ | |
"github.com":"ebab4dc37e654bb230a9c69ebcd5f38e9a81e210" | |
} | |
} | |
} | |
# For using on travis-ci use this. | |
# Copy Method1 Content to this file: .travis.composer.config.json | |
before_script: | |
# Set the GitHub OAuth token to make use of the 6000 per hour rate limit | |
- "mkdir -p ~/.composer" | |
- cp .travis.composer.config.json ~/.composer/config.json | |
#---------------- | |
# Method 2: | |
# Works with local composer, as well as satis! | |
# Add the token to the users conposer config. | |
php composer.phar config --global github-oauth.github.com ebab4dc37e654bb230a9c69ebcd5f38e9a81e210 | |
# Resources: | |
# https://github.com/rjocoleman/auto-updating-satis/blob/master/Boxfile | |
# http://blog.simplytestable.com/creating-and-using-a-github-oauth-token-with-travis-and-composer/ | |
# http://alister.github.io/blog/2013/10/17/avoiding-composer-being-rate-limited-by-github/ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment