Skip to content

Commit 7d7f7dd

Browse files
authoredSep 2, 2020
feat: fix auth issue (#2203)
1 parent 4e9468e commit 7d7f7dd

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed
 

‎plugins/auth/index.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ const authPlugin = {
183183
const token = await tokenFactory.get({ value: tokenValue });
184184

185185
if (!token) {
186-
return { isValid: false };
186+
return { isValid: false, credentials: {} };
187187
}
188188
let profile;
189189

@@ -192,7 +192,7 @@ const authPlugin = {
192192
const user = await userFactory.get({ accessToken: tokenValue });
193193

194194
if (!user) {
195-
return { isValid: false };
195+
return { isValid: false, credentials: {} };
196196
}
197197

198198
const description = `The default collection for ${user.username}`;
@@ -224,7 +224,7 @@ const authPlugin = {
224224
const pipeline = await pipelineFactory.get({ accessToken: tokenValue });
225225

226226
if (!pipeline) {
227-
return { isValid: false };
227+
return { isValid: false, credentials: {} };
228228
}
229229

230230
const admin = await pipeline.admin;
@@ -237,17 +237,17 @@ const authPlugin = {
237237
};
238238
}
239239
if (!profile) {
240-
return { isValid: false };
240+
return { isValid: false, credentials: {} };
241241
}
242242

243243
request.log(['auth'], `${profile.username} has logged in via ${profile.scope[0]} API keys`);
244244
profile.token = server.plugins.auth.generateToken(profile);
245245

246-
return { isValid: true, profile };
246+
return { isValid: true, credentials: profile };
247247
} catch (err) {
248248
request.log(['auth', 'error'], err);
249249

250-
return { isValid: false };
250+
return { isValid: false, credentials: {} };
251251
}
252252
}
253253
});

0 commit comments

Comments
 (0)
Please sign in to comment.