propro-utils 1.4.89 → 1.4.91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/src/server/index.js
CHANGED
|
@@ -149,7 +149,7 @@ class AuthMiddleware {
|
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
try {
|
|
152
|
-
const { tokens, account
|
|
152
|
+
const { tokens, account } = await exchangeToken(
|
|
153
153
|
this.options.authUrl,
|
|
154
154
|
code,
|
|
155
155
|
this.options.clientId,
|
|
@@ -162,9 +162,9 @@ class AuthMiddleware {
|
|
|
162
162
|
if (returnTokens === 'true') {
|
|
163
163
|
return res.status(200).json({ account, user, tokens });
|
|
164
164
|
}
|
|
165
|
-
setAuthCookies(res, tokens, account, user,
|
|
165
|
+
setAuthCookies(res, tokens, account, user, this.options.appUrl);
|
|
166
166
|
|
|
167
|
-
res.redirect(formatRedirectUrl(
|
|
167
|
+
res.redirect(formatRedirectUrl(this.options.appUrl));
|
|
168
168
|
} catch (error) {
|
|
169
169
|
console.error('Error in callback:', error);
|
|
170
170
|
res.status(500).send('Internal Server Error');
|
|
@@ -151,7 +151,10 @@ function formatRedirectUrl(redirectUrl) {
|
|
|
151
151
|
!redirectUrl.startsWith('http://') &&
|
|
152
152
|
!redirectUrl.startsWith('https://')
|
|
153
153
|
) {
|
|
154
|
-
if (
|
|
154
|
+
if (
|
|
155
|
+
redirectUrl.includes('localhost') |
|
|
156
|
+
redirectUrl.includes('host.docker.internal')
|
|
157
|
+
) {
|
|
155
158
|
urlToRedirect = `http://${redirectUrl}`;
|
|
156
159
|
} else {
|
|
157
160
|
urlToRedirect = `https://${redirectUrl}`;
|