Comments (8)
I would add options(gargle_verbosity = "debug")
to your debugging strategy, just to expose more information.
One hypothesis is that the user associated with the Task Scheduler job doesn't have permission to use the token. I would add some print debugging around: does the token (file) I need exist? what are my permissions with respect to that file?
from gmailr.
Hi Jenny, thanks for your help on this!
I used file.access()
with the Task Scheduler job to check the permissions of the token file. It indicated that the token file existed and that I had read, write, and execute access to the token file.
I deleted the .secret cache folder and manually ran the script to re-authenticate gmailr, but I'm still having the same issue.
One thing I keep noticing in the debugging output with options(gargle_verbosity = "debug")
is that it appears gm_auth()
isn't able to find a matching token in the cache.
[removed preceding code for readability]
no matching token in the cache
initiating new token
Error caught by `token_fetch()`:
OAuth2 flow requires an interactive session.
Error: Can't get Google credentials.
Are you running gmailr in a non-interactive session? Consider:
* Call `gm_auth()` directly with all necessary specifics.
Execution halted
I'm not really sure why that would be. It finds a match when I run the script manually. It finds a match when I provides the cache, scopes, and email to token_fetch()
. But for whatever reason, it's not finding a match whenever I run the script through Task Scheduler.
from gmailr.
If add more debugging to gargle, are you in a position to install a dev version of gargle so we can dig into the cache miss?
from gmailr.
We can. Let me know which dev version to install, and I can use that to provide more info on the cache miss.
from gmailr.
The current dev version of gargle has more debugging statements that reveal the pieces of info that go into the strings used to key the tokens. Hopefully that will reveal what is different when you are making the token vs. when you are trying to retrieve it.
I would install with pak::pak("r-lib/gargle")
but you could also use remotes::install_github("r-lib/gargle")
or whatever your preferred method is for installing dev packages from GitHub.
from gmailr.
Thanks for providing that dev version! When I installed the dev version, I was able to successfully run the job through Task Scheduler, and the email was sent as intended. Just to double check, I re-installed the version of gargle from Cran (gargle 1.4.0), and I got the same error message that I was getting before. It looks like something included in the dev version has addressed the issue.
For whatever it's worth, the new debugging info that's included in the dev version looks really good. Even though I didn't get to use it to troubleshoot the problem, it looks like it would have been really helpful.
from gmailr.
Well, that's very interesting!
There is no change in dev gargle that I explicitly expected to address/fix this. But I guess there's one that might be related (r-lib/gargle@0b45026). I guess we'll just take the win!
I plan to release gargle very soon. Can this be closed now?
from gmailr.
I think we're good to close. Thank you again for all of your help on this!
from gmailr.
Related Issues (20)
- Problem on R 4.2.1? HOT 8
- gm_auth_configure() and gm_send_message() work locally but not remotely on Cloud Build with same JSON file (or key and secret) specified HOT 7
- Update `gm_auth_configure()` to take `client` HOT 1
- Upkeep for gmailr
- `usethis::use_readme_rmd()`
- Update errors to rlang 1.0.0. Helpful guides:
- Add the web / pseudo-oob case to the OAuth client article
- Move lots of README content to articles
- Make it possible to pass `subject` to `gm_auth()`
- Update Get Started
- send another email in the same thread HOT 1
- Release gmailr 2.0.0 HOT 2
- Authentication expiring repetitively for non-interactive auth HOT 2
- Subject becomes garbled when it contains accented character and more than 55 characters HOT 2
- Are there any changes in gm_auth_configure() -> error: attempt to apply non-function HOT 4
- Upkeep for gmailr (2023)
- Update error for `gmailr_query()`
- gm_date returning current date, not internalDate
- Error with gm_auth_configure pulling from gargle package HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gmailr.