anthonyjgrove / react-google-login

A React Google Login Component
https://anthonyjgrove.github.io/react-google-login
MIT License
1.84k stars 427 forks source link

403: Request had insufficient authentication scopes. #548

Open pguardiario opened 1 year ago

pguardiario commented 1 year ago

Does anyone know what scopes I need to access this api endpoint? https://gmail.googleapis.com/gmail/v1/users/{userId}/messages

const login = useGoogleLogin({
    onSuccess: async codeResponse => {
      let {code} = codeResponse
      const {data} = await axios.post('http://localhost:3000/auth/google', {
        code,
      });
      setAccessToken(data.access_token)
    },
    flow: 'auth-code',
    scope: "???",
});

Also how I can get userId for the oauth user. Thanks.