Score:0

my google api give me 'GET FILES ERRORS Error: invalid_grant' during access my g-drives folder and files

mx flag

i am trying to access files and foldes through google api by using authenticated access token and other credential but i got error caller 'GET FILES ERRORS Error: invalid_grant', even i use proper scops and access type 'offline' and also i did't revoke permission through user's email.

`const refresh_token = getAccessoken.refresh_token

                    let oAuth2Client = new google.auth.OAuth2(CLIENT_ID, CLIENT_SECRET, REDIRECT_URL);
                    oAuth2Client.setCredentials({ refresh_token: refresh_token });

                    const drive = google.drive({ version: "v3", auth: oAuth2Client });
                    let getFiles = await driveHelper.getFiles(drive, {
                        pageToken: "",
                        pageSize: 1000,
                        q: "'root' in parents and mimeType='application/vnd.google-apps.folder' and trashed = false",
                        spaces: 'drive',
                        fields: "files(id , name , modifiedTime , mimeType),nextPageToken", //size createdTime parents
                    })`

another,

`getFiles: async (drive, obj) => { return new Promise(async (resolve, reject) => { await drive.files.list(obj, async (err, data ) => {

            if (err) {
                console.log('GET FILES ERRORS ' + err)
            } else {
                resolve(data?.data.files)
            }
        })
    })
},`
John Hanley avatar
cn flag
Please include a complete example. Your code is incomplete.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.