This is small tool to provide possibility to use different host and port when using OAuth2 code flow.
- Install package:
$ npm i --save oauth-code-flow-proxy
$ yarn add oauth-code-flow-proxy
-
Create
oatuh-proxy.config.js
in the porject root folder -
Start command via your trminal:
$ oauth-code-flow-proxy
This tool works next way:
- Configure OAuth service to use deployed proxy uri as
redirect_uri
parameter. - Your application should send
auth
request to retrieve auth code to the OAuth Service and use[proxyUri]?[proxyParam]=[yourAppUri]
asredirect_uri
. - You application should send code (request for token) to the OAuth Service and again use the same
redirect_uri
. - Done!!! Now you have your token.
- --config=path_to_configuration_file // you can specify path to your configuration file and not use default.
module.exports = {
port = 8888, // port to run proxy server, default is 8888
proxyParam = 'proxy_to', // param to redirect after proxy recieved request, it should be used when you will do request to OAuth2 API
allow = '.*', // regexp or array of regexps to protect your proxy. You can specify rools to which urls proxy can redirect after request from OAuth2 service
}