https://github.com/artema/oauth-reverse-proxy
Express/Connect middleware for reverse proxying OAuth 1 web services. Can be used to perform OAuth-protected service calls without exposing consumer and token key pairs on the client side.
https://github.com/artema/oauth-reverse-proxy
Last synced: 17 days ago
JSON representation
Express/Connect middleware for reverse proxying OAuth 1 web services. Can be used to perform OAuth-protected service calls without exposing consumer and token key pairs on the client side.
- Host: GitHub
- URL: https://github.com/artema/oauth-reverse-proxy
- Owner: artema
- Created: 2014-07-17T14:42:00.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2014-07-26T11:43:56.000Z (almost 11 years ago)
- Last Synced: 2025-04-22T03:29:29.893Z (about 1 month ago)
- Language: JavaScript
- Homepage: http://abashev.com/oauth-reverse-proxy/
- Size: 160 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
oauth-reverse-proxy
===================Express/Connect middleware for reverse proxying OAuth 1 web services. Can be used to perform OAuth-protected service calls without exposing consumer and token key pairs on the client side.
`npm install oauth-reverse-proxy`
# Usage
var app = require('express')();
var when = require('when');app.use(require('oauth-reverse-proxy').oauth1({
endpoint: '/api/',
target: 'https://api.twitter.com/1.1/',
provider: function(req) {
return when({
consumerKey: 'eWudHldSbIaelX7swmsiHImEL4KinwaGloHANdrY',
consumerSecret: '2EEfA6BG3ly3sR3RjE0IBSnlQu4ZrUzPiYKmrkVU',
tokenKey: 'Z6eEdO8MOmk394WozF5oKyuAv855l4Mlqo7hhlSLik',
tokenSecret: 'Kd75W4OQfb2oJTV0vzGzeXftVAwgMnEK9MumzYcM'
});
},
credentials: {
consumerKey: 'eWudHldSbIaelX7swmsiHImEL4KinwaGloHANdrY',
consumerSecret: '2EEfA6BG3ly3sR3RjE0IBSnlQu4ZrUzPiYKmrkVU',
tokenKey: 'Z6eEdO8MOmk394WozF5oKyuAv855l4Mlqo7hhlSLik',
tokenSecret: 'Kd75W4OQfb2oJTV0vzGzeXftVAwgMnEK9MumzYcM'
}
}));`http://mywebsite.com/api/statuses/user_timeline.json` will proxy `https://api.twitter.com/1.1/statuses/user_timeline.json`.
`endpoint`: Website path that will be used as an endpoint for API requests.
`target`: Target API URL.
`provider`: OAuth credentialsprovider. A Function that will be invoked for each API request. Takes `req` argument with the current request object. Must return a promise with a credentials object, `{}` for unauthorized API calls or `null` to send a 401 error to a client.
`credentials` (optional): static OAuth credentials to use for all requests.
`signatureMethod` (optional): OAuth signature method. Defaults to `HMAC-SHA1`.
`keepCookies` (optional): Keep cookies header in API requests. Defaults to `false`.