-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use apex_oauth with node4ords ? #33
Comments
I'm not 100% sure how to resolve this issue. You could try to modify @krisrice any ideas? |
If you're redirecting then why would you need CORS? Maybe @rhjmartens could help. |
Hi, The above error occurs when the application tries to make the code below:
So I changed the
After that, I changed the redirect link to the link below:
And now the error that is being displayed is the error below: When I click on the link generated by pck, the google page opens correctly ... however redirect does not work. I believe there is something wrong or missing from my proxy rule. Thanks for listening. |
Hi,
Yes I think your proxy rule is not in order.
Try to use the URL in your log in a web-browser. If you do not see Google page, proxy is not working.
I do not know how to set up proxy on node.js
Met vriendelijke groet, Kind regards, Vale
Richard Martens
Bosscheweg 44 a
5056 KC Berkel-Enschot
The Netherlands
t: +31 6 579 46 631
e: [email protected]
Chamber of Commerce: 67.49.69.46
The information contained in this communication is intended solely for the use of the individual or entity to whom it is addressed. If you are not the intended recipient of this communication please return the communication to the sender and delete and destroy all copies. In that case you must not use, disclose, distribute, copy, print or rely on this communication.
SMART4Solutions B.V. is neither liable for the proper and complete transmission of the information contained in this communication nor for any delay in its receipt. SMART4Solutions B.V. does not guarantee that the integrity of this communication has been maintained nor that the communication is free of viruses, interceptions or interference.
Van: tiagosteil <[email protected]>
Beantwoorden - Aan: OraOpenSource/node4ords <[email protected]>
Datum: maandag 17 april 2017 21:27
Aan: OraOpenSource/node4ords <[email protected]>
CC: Richard Martens <[email protected]>, Mention <[email protected]>
Onderwerp: Re: [OraOpenSource/node4ords] How to use apex_oauth with node4ords ? (#33)
Hi,
The above error occurs when the application tries to make the code below:
t_url := 'https://accounts.google.com/o/oauth2/auth?client_id=' || g_provider.client_id
|| '&redirect_uri=' || g_provider.redirect_uri
|| '&scope=' || apex_util.url_encode(g_provider.scope)
|| '&state=' || v('APP_SESSION') || ':' || v('WORKSPACE_ID') || ':' || v('APP_ID') || ':' || p_gotopage
|| '&response_type=' || 'code' -- mandatory for google
|| g_provider.extras
|| case g_provider.force_approval
when 'Y' then '&approval_prompt=force'
else ''
end;
owa_util.redirect_url ( t_url );
So I changed the /opt/node4ords/app.js file and created the following proxy rule below:
app.use('/acgoogle', proxy(
{
target: 'https://accounts.google.com/',
changeOrigin: true,
https: true,
onProxyRes: function(proxyRes, req, res){
proxyRes.headers['Access-Control-Allow-Origin'] = '*';
if (req.headers['access-control-request-method']) {
res.setHeader('access-control-allow-methods', req.headers['access-control-request-method']);
}
if (req.headers['access-control-request-headers']) {
res.setHeader('access-control-allow-headers', req.headers['access-control-request-headers']);
}
},
pathRewrite: {
'^/acgoogle' : '/'
}
}
));
After that, I changed the redirect link to the link below:
t_url := 'http://myhost/acgoogle/o/oauth2/auth?client_id=' || g_provider.client_id
|| '&redirect_uri=' || g_provider.redirect_uri
|| '&scope=' || apex_util.url_encode(g_provider.scope)
|| '&state=' || v('APP_SESSION') || ':' || v('WORKSPACE_ID') || ':' || v('APP_ID') || ':' || p_gotopage
|| '&response_type=' || 'code' -- mandatory for google
|| g_provider.extras
|| case g_provider.force_approval
when 'Y' then '&approval_prompt=force'
else ''
end
;
owa_util.redirect_url ( t_url );
And now the error that is being displayed is the error below:
When I click on the link generated by pck, the google page opens correctly ... however redirect does not work.
I believe there is something wrong or missing from my proxy rule.
Thanks for listening.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
The origin is getting lost somehow. I've never used this but did notice this in the wiki |
I put this option to true, but I do not know if it's in the correct place. app.use('/acgoogle', proxy(
{
target: 'https://accounts.google.com/',
changeOrigin: true,
https: true,
onProxyRes: function(proxyRes, req, res){
proxyRes.headers['Access-Control-Allow-Origin'] = '*';
if (req.headers['access-control-request-method']) {
res.setHeader('access-control-allow-methods', req.headers['access-control-request-method']);
}
if (req.headers['access-control-request-headers']) {
res.setHeader('access-control-allow-headers', req.headers['access-control-request-headers']);
}
},
pathRewrite: {
'^/acgoogle' : '/'
}
}
)); |
Hi
I'm using node4ords as weblistener on my server with the OXAR project: Https://github.com/OraOpenSource/OXAR
And now I want to use this project below to be able to perform the
Login with Gmail: Https://github.com/smart4solutions/apex_oauth
However I have a problem to redirect the user to the
Google login page, which I researched is due to CORS.
In the apex_oauth project Is cited to create a reverse proxy.
How do I do this reverse proxy on node4ords?
Thank you for your attention.
The text was updated successfully, but these errors were encountered: