[Solved] use google auth to access other google apis (e.g. Calendar/Drive)
Hello,
Once I've authenticated with better-auth for the Google provider, how can I go about using other Google APIs? (e.g. using googleapis, the Node.JS Client).
In Next-Auth/Auth.js, this is possible because we have access to the
accessToken
and refreshToken
:
- https://github.com/nextauthjs/next-auth/issues/1162#issuecomment-766331341
But in better-auth, this is all I can see for the session:
GitHub
Using auth to access other googleapis · Issue #1162 · nextauthjs/ne...
Your question What is the best way of using next-auth as an auth instant to googleapis? What are you trying to do I'm trying to send a mail with gmail api from the backend. Feedback Documentati...
1 Reply
Solved - you will need to query the
account
table, where your accessToken and refreshToken resides.
Example (I'm using the drizzle-orm adapter):