feathers
feathers copied to clipboard
OAuth not respecting path in feathers v4
Steps to reproduce
Refer to #2116, I met the similar problem in feathers v4.
In my local host to run, everything is working,
bu when I use ingress nginx proxy, and let locahost:3030 convert to mysite.com/url_path.
I'm attempting to call https://mysite.com/url_path/oauth/microsoft, then res.redirect will redirect to https://mysite.com/oauth/connect/microsoft, url_path lost, so frontend page show the blank which console log Refused to apply style from 'https://mysite.com/oauth/connect/assets/vue-datepicker-next.6d02e2ec.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
// @feathersjs/authentication-oauth/lib/express.js
authApp.get('/:name', (req, res) => {
const _a = req.query, { feathers_token, redirect } = _a, query = __rest(_a, ["feathers_token", "redirect"]);
const { name } = req.params;
if (feathers_token) {
debug(`Got feathers_token query parameter to link accounts`, feathers_token);
req.session.accessToken = feathers_token;
}
req.session.redirect = redirect;
req.session.query = query;
req.session.save((err) => {
if (err) {
res.status(500).send(`Error storing session: ${err}`);
}
else {
res.redirect(`${path}/connect/${name}?${querystring_1.default.stringify(query)}`);
}
});
});
Moreover, I also try to set oauth.default.path. When I call https://mysite.com/url_path/oauth/microsoft, it will show 404 error directly and will not redirect.
// config.json
"oauth": {
"redirect": "/",
"defaults": {
"path": "/url_path/oauth"
},
I've read through the documentation for Feathers v4 and for Grant v4.7.0 several times, but can't come up with a solution. I've seen a few other issues here or questions on StackOverflow with similar problems, but can't find an answer. Any insights as to how I should accomplish this?
Expected behavior
Expected behavior to call https://mysite.com/url_path/oauth/microsoft, then res.redirect will redirect to https://mysite.com/url_path/oauth/connect/microsoft
Actual behavior
I call https://mysite.com/url_path/oauth/microsoft, then res.redirect will redirect to https://mysite.com/oauth/connect/microsoft, url_path lost.
System configuration
Feathers version: v4
Grant: v4.7.0