Skip to content
This repository has been archived by the owner on Jan 24, 2019. It is now read-only.

Ability to curl with cached access token #334

Open
ac111 opened this issue Jan 4, 2017 · 7 comments
Open

Ability to curl with cached access token #334

ac111 opened this issue Jan 4, 2017 · 7 comments

Comments

@ac111
Copy link

ac111 commented Jan 4, 2017

Just a general question (quite new to using oauth2) -- I have an auth2 proxy server (google auth) running locally and proxying requests to an upstream Nexus server. I can successfully authenticate using a standard browser, and can re-use the session to download artifacts from a Nexus repo. Is there a way to perform a similar artifact download using curl or wget by re-using a token?

@groob
Copy link

groob commented Jan 4, 2017

@ac111 you could go to your browsers network tab and "copy as curl"

The link will contain the cookie which curl can use to auth.

@ac111
Copy link
Author

ac111 commented Jan 4, 2017

Thanks for the suggestion! This works nicely -- wondering if you have any experience in generating the token programmatically in a similar way to generate the request?

@groob
Copy link

groob commented Jan 4, 2017

I'm not sure how to generate the token, but I can recommend an alternative that works for me:

Use the nginx auth_request option(see bottom of readme).
Use a different auth scheme for your scripts (I use a JWT token).

With the above setup, the reverse proxy can authenticate with either a valid JWT token or through the normal oauth request strategy in the browser.

@ac111
Copy link
Author

ac111 commented Jan 4, 2017

Thanks, I'll give this a try! Much appreciated

@vegardvaage
Copy link

@ac111 I'm trying to achieve something similar as well - do you think it would be possible to leverage Google service accounts for this? Very interested to hear if you can make this work. @groob, how do you generate your JWT tokens?

@pecigonzalo
Copy link

Same question @groob could you share how do you do this with JWT?

@blaskovicz
Copy link

I need to use the underlying access_token as well to access the github api, so I came up with an alternative solution in #571 which I pull-requested in #572 .

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

6 participants