Set state in local storage when openid provider redirect on jwt with token value
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
This commit is contained in:
parent
7406b62093
commit
1db22d82af
@ -91,6 +91,16 @@ class ConnectionManager {
|
||||
//TODO if jwt is defined, state and nonce can to be deleted
|
||||
const code = urlParams.get("code");
|
||||
const state = urlParams.get("state");
|
||||
const jwt = urlParams.get("jwt");
|
||||
|
||||
if (jwt) {
|
||||
this.authToken = jwt;
|
||||
localUserStore.setAuthToken(jwt);
|
||||
//if we use jwt we can update new state from openid provider
|
||||
if (state) {
|
||||
localUserStore.setState(state);
|
||||
}
|
||||
}
|
||||
if (!state || !localUserStore.verifyState(state)) {
|
||||
throw "Could not validate state!";
|
||||
}
|
||||
@ -98,12 +108,6 @@ class ConnectionManager {
|
||||
throw "No Auth code provided";
|
||||
}
|
||||
localUserStore.setCode(code);
|
||||
|
||||
const jwt = urlParams.get("jwt");
|
||||
if (jwt) {
|
||||
this.authToken = jwt;
|
||||
localUserStore.setAuthToken(jwt);
|
||||
}
|
||||
this._currentRoom = await Room.createRoom(new URL(localUserStore.getLastRoomUrl()));
|
||||
try {
|
||||
await this.checkAuthUserConnexion();
|
||||
|
@ -171,6 +171,9 @@ class LocalUserStore {
|
||||
}
|
||||
return oldValue === value;
|
||||
}
|
||||
setState(value: string) {
|
||||
localStorage.setItem(state, value);
|
||||
}
|
||||
getState(): string | null {
|
||||
return localStorage.getItem(state);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user