propro-utils 1.5.9 → 1.5.11
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 +1 -1
- package/src/server/index.js +8 -2
package/package.json
CHANGED
package/src/server/index.js
CHANGED
|
@@ -107,7 +107,7 @@ class AuthMiddleware {
|
|
|
107
107
|
try {
|
|
108
108
|
const response = await this.proxyToAuthServer(
|
|
109
109
|
req,
|
|
110
|
-
`/api/v1/auth/
|
|
110
|
+
`/api/v1/auth/signup?returnTokens=${returnTokens}`,
|
|
111
111
|
req.body
|
|
112
112
|
);
|
|
113
113
|
|
|
@@ -155,7 +155,8 @@ class AuthMiddleware {
|
|
|
155
155
|
};
|
|
156
156
|
|
|
157
157
|
handleRefreshToken = async (req, res) => {
|
|
158
|
-
const refreshToken =
|
|
158
|
+
const refreshToken =
|
|
159
|
+
req.cookies['x-refresh-token'] || req.headers['x-refresh-token'];
|
|
159
160
|
if (!refreshToken) {
|
|
160
161
|
return res.status(401).json({
|
|
161
162
|
redirectUrl: this.constructRedirectUrl(),
|
|
@@ -174,6 +175,11 @@ class AuthMiddleware {
|
|
|
174
175
|
}
|
|
175
176
|
|
|
176
177
|
const user = await checkIfUserExists(this.userSchema, account.accountId);
|
|
178
|
+
|
|
179
|
+
const { returnTokens } = req.query;
|
|
180
|
+
if (returnTokens === 'true') {
|
|
181
|
+
return res.status(200).json({ account, user, access, refresh });
|
|
182
|
+
}
|
|
177
183
|
setAuthCookies(
|
|
178
184
|
res,
|
|
179
185
|
{ access, refresh },
|