-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 Fix: Pre-emptively trigger login after google token expired #212
base: main
Are you sure you want to change the base?
🐛 Fix: Pre-emptively trigger login after google token expired #212
Conversation
} catch (error) { | ||
if (error instanceof BaseError && error.result === "No access token") { | ||
res.promise({ valid: false, error: "Invalid Google Token" }); | ||
} else { | ||
res.promise({ | ||
valid: null, // We don't know if the session is valid or not, so we return null | ||
error, | ||
}); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would've liked to handle this error more consistently with how other google related errors are handled but I couldn't establish a pattern in functions like isInvalidGoogleToken
|
||
import compassAuthService from "./compass.auth.service"; | ||
|
||
const logger = Logger("app:google.auth.service"); | ||
|
||
export const getGcalClient = async (userId: string) => { | ||
export const getGAuthClientForUser = async ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extracted as its own function for reusability.
Gave the option of providing a mongodb user object or just the userId Providing the user object directly will save a db call for better performance
No big concerns with this at first glance. I want to QA this one more thoroughly to make sure, though. I'm going to hold off on doing that while I wrap up #203 and #196. In the meantime, please find an issue from the 'Ready' column of the board to work on. Alternatively, you could find an issue in the Backlog to refine. By "refine", I mean thinking it through more, adding details, and updating the issue with a high-level description of your suggested implementation. After doing that I'll read through it and give it the 👍 if it looks good to start working on. Since you're more familiar with the codebase and have been producing good work, this could be a good time to pick up a more difficult or larger issue if you're up for it. |
@tyler-dane Thank you! I think I'll opt to work on issues based on the priorities you assigned them since we have a lot of them as ready. Once we start running out of ready issues I'll work on refining existing backlog items |
Implement a new api route to validate a user's google oauth session
also renames controller method from verifyGAuthSession to verifyGToken to more accurately represent what's happening. Compass doesn't maintain a persistent session with Google like it does with it's user's session (via Supertokens). Instead, it just passes the access token in requests
4876592
to
5c77f5e
Compare
making it a class doesn't add much value, as we're not taking advantage of any class benefits (inheritance, class methods, encapsulation)
Fixes issue