Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Commit

Permalink
Merge branch 'master' of https://github.com/jed/authom
Browse files Browse the repository at this point in the history
* 'master' of https://github.com/jed/authom:
  Add state parameter functionality to access token request #55
  Add example to readme
  • Loading branch information
jed committed May 14, 2014
2 parents 6eb0ef1 + 1eac303 commit f03c530
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,28 @@ var instagram = authom.createServer({
})
```

### Reddit ([create an app](https://ssl.reddit.com/prefs/apps/))

Options:

- `service`: "reddit"
- `id`: the application's `CLIENT ID`
- `secret`: the application's `CLIENT SECRET`
- `state`: Unguessable random string.
- `scope` (optional): the scopes requested by your application

Example:

```javascript
var reddit = authom.createServer({
service: "reddit",
id: "hG5c04ZOk0UngQ",
secret: "mdJoGP4ayA9M7NdBiKxZUyewz7M",
state: "unguessable-random-string",
scope: "identity"
})
```

### SoundCloud ([create an app](http://soundcloud.com/you/apps/new))

Options:
Expand Down
6 changes: 6 additions & 0 deletions lib/services/oauth2.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ OAuth2.prototype.onRequest = function(req, res) {
}

OAuth2.prototype.onStart = function(req, res) {
if (req.url.query.state) {
this.code.query.state = req.url.query.state;
delete req.url.search
delete req.url.query.state;
}

this.code.query.redirect_uri = url.format(req.url)

res.writeHead(302, {Location: url.format(this.code)})
Expand Down

0 comments on commit f03c530

Please sign in to comment.