Merge branch 'develop' of github.com:thecodingmachine/workadventure into main
This commit is contained in:
@@ -51,11 +51,11 @@ export class AuthenticateController extends BaseController {
|
||||
const { code, nonce } = parse(req.getQuery());
|
||||
try {
|
||||
const userInfo = await openIDClient.getUserInfo(code as string, nonce as string);
|
||||
const email = userInfo.email || userInfo.sub;
|
||||
if (!email) {
|
||||
throw new Error("No email in the response");
|
||||
const sub = userInfo.sub;
|
||||
if (!sub) {
|
||||
throw new Error("No sub in the response");
|
||||
}
|
||||
const authToken = jwtTokenManager.createAuthToken(email);
|
||||
const authToken = jwtTokenManager.createAuthToken(sub);
|
||||
res.writeStatus("200");
|
||||
this.addCorsHeaders(res);
|
||||
return res.end(JSON.stringify({ authToken }));
|
||||
|
||||
Reference in New Issue
Block a user