Add refresh token handling if returned from server
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user