Skip to content
This repository was archived by the owner on May 5, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
extends: standard
34 changes: 21 additions & 13 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
coverage
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz

pids
logs
results
# OS #
###################
.DS_Store
.idea
Thumbs.db
tmp/
temp/

npm-debug.log

# Node.js #
###################
node_modules
package-lock.json
npm-debug.log
yarn-debug.log
yarn-error.log


# NYC #
###################
coverage
*.lcov
.nyc_output
13 changes: 10 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
language: node_js
node_js:
- '0.11'
script: make test

- 8
- 10
- 12
- 'lts/*'
- 'node'
script:
- npm run test-cov
after_script:
- npm i coveralls
- cat ./coverage/lcov.info | node ./node_modules/coveralls/bin/coveralls
9 changes: 7 additions & 2 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Ordered by date of first contribution.
# Auto-generated by 'contributors' on Wed, 01 Jan 2014 16:08:04 GMT.
# Auto-generated by 'contributors' on Mon, 27 Jan 2020 21:08:08 GMT.
# https://github.com/xingrz/node-contributors

dead_horse <dead_horse@qq.com> (https://github.com/dead-horse)
- [dead_horse](https://github.com/dead-horse)
- [Kamil Gałuszka](https://github.com/galuszkak)
- [Greenkeeper](https://github.com/greenkeeperio-bot)
- [jongleberry](https://github.com/jongleberry)
- [Lee Bousfield](https://github.com/PlasmaPower)
- [3imed-jaberi](https://github.com/3imed-jaberi)
36 changes: 0 additions & 36 deletions Makefile

This file was deleted.

32 changes: 15 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
koa-github [![Build Status](https://secure.travis-ci.org/koajs/koa-github.png)](http://travis-ci.org/koajs/koa-github)
==========
# [**koa-github**](https://github.com/koajs/koa-github)

simple github auth middleware for koa
> Simple github auth middleware for koa.


[![Build Status](https://secure.travis-ci.org/koajs/koa-github.png)](http://travis-ci.org/koajs/koa-github)

[![NPM](https://nodei.co/npm/koa-github.png?downloads=true)](https://nodei.co/npm/koa-github/)


## Example

```js
//use http://localhost:7001 to test

var koa = require('koa');
var http = require('http');
var session = require('koa-sess');
var githubAuth = require('koa-github');
const Koa = require('koa');
const http = require('http');
const session = require('koa-generic-session');
const githubAuth = require('koa-github');

var app = koa();
const app = new Koa();

app.name = 'nae-web';
app.keys = ['key1', 'key2'];
Expand All @@ -29,7 +32,7 @@ app.use(githubAuth({
timeout: 10000
}));

app.use(function *handler() {
app.use(function handler() {
if (!this.session.githubToken) {
this.body = '<a href="/github/auth">login with github</a>';
} else {
Expand All @@ -46,6 +49,7 @@ app.on('error', function (err) {
http.createServer(app.callback()).listen(7001);
```


## Options

```
Expand All @@ -65,13 +69,7 @@ http.createServer(app.callback()).listen(7001);
* if you set userKey field, `koa-github` will request to get the user info and set this object to `this.session[options.userKey]`, otherwise `koa-github` will not do this request.
* if you triggle by `/github/auth?redirect_uri=/callback`, `koa-github` will redirect to `/callback` after auth, and the redirect_uri only accept start with `/`.

## Licences
(The MIT License)

Copyright (c) 2013 dead-horse and other contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
## Licence

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
[MIT](/LICENSE)
37 changes: 0 additions & 37 deletions example.js

This file was deleted.

Loading