fix localuser for OIDC

This commit is contained in:
_Bastler 2021-09-17 14:02:43 +02:00
parent f053ece7da
commit ea64e79e46
2 changed files with 7 additions and 4 deletions

View File

@ -288,11 +288,14 @@ class ConnectionManager {
}
const nonce = localUserStore.getNonce();
const token = localUserStore.getAuthToken();
const { authToken, username } = await Axios.get(`${PUSHER_URL}/login-callback`, { params: { code, nonce, token } }).then(
const { authToken, username, userUuid } = await Axios.get(`${PUSHER_URL}/login-callback`, { params: { code, nonce, token } }).then(
(res) => res.data
);
localUserStore.setAuthToken(authToken);
this.localUser = new LocalUser(userUuid, []);
this.authToken = authToken;
localUserStore.saveUser(this.localUser);
localUserStore.setAuthToken(this.authToken);
gameManager.setPlayerName(username);

View File

@ -68,7 +68,7 @@ export class AuthenticateController extends BaseController {
await openIDClient.checkTokenAuth(authTokenData.hydraAccessToken);
res.writeStatus("200");
this.addCorsHeaders(res);
return res.end(JSON.stringify({ authToken: token, username: authTokenData.username }));
return res.end(JSON.stringify({ authToken: token, username: authTokenData.username, userUuid : authTokenData.identifier }));
} catch (err) {
console.info("User was not connected", err);
}
@ -83,7 +83,7 @@ export class AuthenticateController extends BaseController {
const authToken = jwtTokenManager.createAuthToken(sub, userInfo.access_token, userInfo.username);
res.writeStatus("200");
this.addCorsHeaders(res);
return res.end(JSON.stringify({ authToken: authToken, username: userInfo.username }));
return res.end(JSON.stringify({ authToken: authToken, username: userInfo.username, userUuid : sub }));
} catch (e) {
return this.errorToResponse(e, res);
}