OAuth authentication 'httr' package on Travis CI

Hi,

Please does anyone have an idea on how to implement OAuth using httr package for a system that is automatically built using Travis CI?

The problem here is to be able to securely have the token within the Travis environment.
I tried to automatically generate the token within Travis during build, but build hangs for a long time and then terminates. I guess the OAuth flow waits for authentication via a browser and then fails when nothing happens.

I am able to authenticate on my local PC, because when prompted on the browser, I just click 'OK' to authenticate.

Many thanks for any help.

1 Like

You might take a look at how to use ci environmental variables, as in the tic package:
https://ropenscilabs.github.io/tic/articles/advanced.html#pkgdown-deployment

1 Like

Thank you, I looked at the link.

The token is an .rds file. I am not certain that this could be passed as an environment variable.

A few questions:

  1. What service are you trying to authenticate with? For what purpose? Are you querying information or deploying your code to another service?

  2. Instead of generating the token during the CI build, have you tried generating the token locally, encrypting it, and then sending it to Travis? For an example, see these instructions from Jenny Bryan to register a Google OAuth token with Travis.

2 Likes

Thank you.

I was trying to automate authentication with Meetup API and your link provided great help.
Thank you.