propro-utils 1.4.53 → 1.4.55

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "propro-utils",
3
- "version": "1.4.53",
3
+ "version": "1.4.55",
4
4
  "description": "Auth middleware for propro-auth",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/index.js CHANGED
@@ -50,6 +50,7 @@ module.exports = function proproAuthMiddleware(options = {}, userSchema) {
50
50
  'CLIENT_SECRET',
51
51
  'CLIENT_URL',
52
52
  'REDIRECT_URI',
53
+ 'APP_URL',
53
54
  ]);
54
55
  return (req, res, next) => {
55
56
  try {
@@ -100,7 +100,7 @@ function proproAuthMiddleware(options = {}, userSchema) {
100
100
 
101
101
  const user = await checkIfUserExists(userSchema, account.accountId);
102
102
 
103
- setAuthCookies(res, { access, refresh }, account, user);
103
+ setAuthCookies(res, { access, refresh }, account, user, appUrl);
104
104
 
105
105
  return res
106
106
  .status(200)
@@ -113,6 +113,9 @@ function proproAuthMiddleware(options = {}, userSchema) {
113
113
  return res.status(400).send('No code received');
114
114
  }
115
115
 
116
+ console.log('code: ', code);
117
+ console.log('redirectUri: ', redirectUri);
118
+
116
119
  const { tokens, account, redirectUrl } = await exchangeToken(
117
120
  authUrl,
118
121
  code,
@@ -121,9 +124,11 @@ function proproAuthMiddleware(options = {}, userSchema) {
121
124
  redirectUri
122
125
  );
123
126
 
127
+ console.log('tokens: ', tokens);
128
+
124
129
  const user = await checkIfUserExists(userSchema, account.accountId);
125
130
 
126
- setAuthCookies(res, tokens, account, user, appUrl);
131
+ setAuthCookies(res, tokens, account, user, redirectUrl);
127
132
 
128
133
  const urlToRedirect = formatRedirectUrl(redirectUrl);
129
134