Add refresh token handling if returned from server
This commit is contained in:
parent
d438760e36
commit
79547143a8
1 changed files with 74 additions and 8 deletions
|
|
@ -24,9 +24,12 @@ const OAuthCallback = () => {
|
|||
}
|
||||
|
||||
try {
|
||||
const accessToken = await handleOAuthCallback(serverUrl, code);
|
||||
// Store the access token for future use
|
||||
sessionStorage.setItem(SESSION_KEYS.ACCESS_TOKEN, accessToken);
|
||||
const tokens = await handleOAuthCallback(serverUrl, code);
|
||||
// Store both access and refresh tokens
|
||||
sessionStorage.setItem(SESSION_KEYS.ACCESS_TOKEN, tokens.access_token);
|
||||
if (tokens.refresh_token) {
|
||||
sessionStorage.setItem(SESSION_KEYS.REFRESH_TOKEN, tokens.refresh_token);
|
||||
}
|
||||
// Redirect back to the main app with server URL to trigger auto-connect
|
||||
window.location.href = `/?serverUrl=${encodeURIComponent(serverUrl)}`;
|
||||
} catch (error) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue