79324742

Date: 2025-01-02 19:20:07
Score: 0.5
Natty:
Report link

The access token that Firebase Auth gives can be substituted for the OAuth2Client you'd normally use in the Node.js server:

     const result = await signInWithPopup(auth, provider);
     const credential = GoogleAuthProvider.credentialFromResult(result);

     const token = credential?.accessToken;
     const studentData = await classroom.courses.students.list({
        courseId,
        auth: token,
      });

This is odd because when I try to use the access token I get from passport-google-oauth2 it throws an error.

It also stopped working after the first time because the googleapis package is meant for server environments from what I can understand, and Vite started throwing errors.

How to implement Google API with React, Redux and Webpack

Manually typing the fetch request is best solution for now.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: bit07123