简体   繁体   中英

How to re-run the authentication in the r package meetupr?

I am trying to use the meetupr package from this repository: https://github.com/rladies/meetupr . According to the ReadMe, a token is created the first time when running a meetupr function. In my case the Meetup server had problems at the time when I used the package, which is why I could not log in and generate the token. Now, when trying to run meetupr I get the error

Cannot read token from alleged .rds file:
~/.local/share/meetupr/meetupr-token.rds

The file mentioned in this error message is empty.

This error arises for example when I run:

library(meetupr)
find_groups(text = "book")

OS: Ubuntu 20.04

R: version 4.1.2

Browser: Firefox 94.0

I already tried to remove.packages("meetupr") and install.packages("meetupr") again, but that didn't help.

How do I re-run the authentification function to create a token in this file?

Deleting the .rds file located in the folder that is returned by the following command should help:

rappdirs::user_data_dir("meetupr", "meetupr")

If you don't tweak anything, the first time you run a meetupr function, you'll be prompted to go into your browser and a token will be created. It will be saved to disk in an app directory as determined by rappdirs::user_data_dir("meetupr", "meetupr")

(Source: meetupr README )

So I think what happened is that while the authentication was not successful, the file was still created but without a valid token inside. meetupr thinks that if you have the file, you have a valid token. Deleting the file should re-trigger the oauth flow.

You have not described with any detail what all of your actions have been and what your system applications have been telling you. I offer an example of what you might have offered. Obviously you woulld not be post the same, but this should give you an example of what a more complete description of the full process might look like:


I am unable to reproduce this error running R 4.0.4 on Ubuntu 18.04 with Chrome as my default browser; After installing the package per its github page and running that code, I first see this message... 在此处输入图像描述

... and after clicking allow, a new page pops up...

在此处输入图像描述

And after closing that page per instructions I see this at the console:

> find_groups(text = "book")
Adding ~/.local/share/meetupr/meetupr-token.rds to .gitignore
Waiting for authentication in browser...
Press Esc/Ctrl + C to abort
Authentication complete.
Downloading 16722 record(s)...
Error in curl::curl_fetch_memory(url, handle = handle) : 
  Operation was aborted by an application callback

I got tired of waiting for that many records to download and hit escape, and ran:

`meetupr-token` <- readRDS("/home/david/.local/share/meetupr/meetupr-token.rds")
`meetupr-token`
$`3a1a-munged--7b8e764968950`
<Token>
<oauth_endpoint>
 authorize: https://secure.meetup.com/oauth2/authorize
 access:    https://secure.meetup.com/oauth2/access
<oauth_app> meetup
  key:    2vag-munged-b32tca763m1
  secret: <hidden>
<credentials> access_token, refresh_token, token_type, expires_in
---

So the file is not empty. I then re-ran a call to the find_groups function using a less broad search term, and get (without any popup browser page):

find_groups(text = "Tai chi")
Downloading 863 record(s)...
# A tibble: 863 × 21
       id name  urlname status   lat     lon city  state country created            
    <int> <chr> <chr>   <chr>  <dbl>   <dbl> <chr> <chr> <chr>   <dttm>             
 1 3.08e7 Beac… Beachs… active  35.2  -83.4  Fran… "NC"  USA     2018-12-24 04:28:57
 2 3.17e7 Tai … Tai-Ch… active  26.2  -80.3  Fort… "FL"  USA     2019-04-25 16:10:30
 3 3.46e7 The … the-ta… active  33.2 -117.   Ocea… "CA"  USA     2021-01-01 01:10:51
 4 8.42e5 The … sifu-t… active  40.9  -73.8  Bron… "NY"  USA     2007-11-26 02:16:11
 5 2.68e7 Yang… Yangsh… active  51.8   -0.83 Ayle… "B9"  United… 2017-12-07 09:00:56
 6 3.40e7 Drag… Dragon… active  41.6  -72.8  Berl… "CT"  USA     2020-08-02 11:18:44
 7 2.68e7 Tai … Tai-Ch… active -33.9   18.5  Cape… ""    South … 2017-12-08 23:39:01
 8 2.39e7 The … The-Sc… active  50.8   -0.15 Brig… "P6"  United… 2017-05-21 14:02:24
 9 2.26e7 Auck… Auckla… active -36.8  175.   Auck… ""    New Ze… 2017-02-26 01:06:20
10 1.87e7 Tai … Larkers active  45.0  -93.2  Minn… "MN"  USA     2015-06-26 16:27:37
# … with 853 more rows, and 11 more variables: members <int>, timezone <chr>,
#   join_mode <chr>, visibility <chr>, who <chr>, location <chr>,
#   organizer_id <int>, organizer_name <chr>, category_id <int>,
#   category_name <chr>, resource <list>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM