mirror of
https://github.com/usebruno/bruno.git
synced 2026-07-02 17:08:32 +00:00
check if token is expired only if expires_in prop is present, clear response and clear timeline are 2 different things, clear redux state after clearing oauth2 credentials cache
This commit is contained in:
@@ -25,8 +25,11 @@ const getStoredOauth2Credentials = ({ collectionUid, url, credentialsId }) => {
|
||||
};
|
||||
|
||||
const isTokenExpired = (credentials) => {
|
||||
if (!credentials || !credentials.expires_in || !credentials.created_at) {
|
||||
return true; // Assume expired if missing data
|
||||
if (!credentials?.access_token) {
|
||||
return true;
|
||||
}
|
||||
if (!credentials?.expires_in || !credentials.created_at) {
|
||||
return false;
|
||||
}
|
||||
const expiryTime = credentials.created_at + credentials.expires_in * 1000;
|
||||
return Date.now() > expiryTime;
|
||||
|
||||
Reference in New Issue
Block a user