httr2 icon indicating copy to clipboard operation
httr2 copied to clipboard

Equivalent of `fetch_token` with `auth_code`

Open vanhry opened this issue 3 years ago • 0 comments

Hello everyone! I want to replicate python example of receiving both access and refresh tokens, like here (Python)

token_response = oauth2_session.fetch_token(TOKEN_GRANT_URL, code=AUTHORIZATION_CODE, client_secret=CLIENT_SECRET)

How could I do it using httr2 library?

There are my previous steps to get the AUTHORIZATION_CODE (R)

client <- httr2::oauth_client(token_url = token_grant_url,secret = .app_secret,id = .app_key)
url_to_browse <- httr2::oauth_flow_auth_code_url(client=client, auth_url = auth_url,
                                                 scope = paste0(SCOPES_TO_REQUEST, collapse = " "),
                                                 redirect_uri = .client_redirect,state = STATE)

But I don't understand which function should I use instead of fetch_token Thanks for any help you can provide

vanhry avatar Jun 07 '22 12:06 vanhry