httr icon indicating copy to clipboard operation
httr copied to clipboard

OAuth2.0 in shiny app

Open fmmattioni opened this issue 4 years ago • 1 comments

I was wondering if there is a way to trigger an API authorization based on an actionButton()?

I am trying to achieve some similar of the solution described here: https://gist.github.com/hadley/144c406871768d0cbe66b0b810160528.

My problem, though, is that I need to trigger this only when the user clicks the button. I have spent a couple of hours trying a lot of different ways to achieve this, but without success.

To illustrate:

1 - User clicks a button. 2 - Authentication to an API is triggered, where the user will be redirected to the 3rd party website for authentication. 3 - Once auth is successful, redirect back to the app. 4 - Save the token (to AWS S3 bucket perhaps) for using it for now on, so the user won't have to authenticate every time.

Thoughts?

fmmattioni avatar Apr 08 '21 19:04 fmmattioni

I am wondering the same atm :P Did you find a solution yet?

jstet avatar May 01 '21 23:05 jstet

httr has been superseded in favour of httr2, so is no longer under active development. If this problem is still important to you in httr2, I'd suggest filing an issue offer there 😄 — httr2 generally has much better OAuth tooling, but I don't think we've yet fully cracked the problem of using it within shiny. Thanks for using httr!

hadley avatar Oct 31 '23 19:10 hadley