gmail-tester: invalid_grant issue
Hi,
I’ve had the gmail-tester plugin work for a couple of days after setting it up, but then every few days it breaks with this error:
CypressError: cy.task('gmail:check')
failed with the following error:
invalid_grant https://on.cypress.io/api/task
Anyone have any idea what could be going wrong here? I really need this to work consistently.
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 2
- Comments: 19 (2 by maintainers)
NOPE
Hey, has anyone found a solution for that? Would the current implementation be able to use a Google Service Account?
That doesn’t really fix the problem, in 7 days you will get invalid_grant again. Still hoping someone is able to come up with a permanent solution.
Still not sure how to use it. All it says in that readme is this: refresh_access_token(credentials_json, token_path) credentials_json: Path to credentials JSON file. token_path: Path to existing OAuth2 token file. Refresh the access token. A new file will overwrite the existing one in token_path.
From that I don’t understand how to actually refresh a token, there’s no code example, or anything.
It looks like its working fine, on cypress.config.js I have: on(“task”, { “gmail:refreshAccessToken”: async args => { const token = await gmail_tester.refresh_access_token(‘./cypress/plugins/credentials.json’, ‘./cypress/plugins/token.json’) return config } })
on test: cy.task(“gmail:refreshAccessToken”)
and expirydate (…“expiry_date”:1665564390017}) is refreshed every time the task is launched.
It would be a great solution to authenticate via Google Service Account @levz0r