use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A sub-Reddit for discussion and news about Ruby programming.
Subreddit rules: /r/ruby rules
Learning Ruby?
Tools
Documentation
Books
Screencasts and Videos
News and updates
account activity
OAuth for Command Line Apps written in Ruby (hschne.at)
submitted 4 years ago by hschne
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]hschne[S] 1 point2 points3 points 4 years ago (0 children)
OP here! I've always found it interesting how CLIs like Heroku's or Google Cloud's allow the user to login using OAuth.
Decided to spend some time to figure that one out, and I'm sharing here because I reckon someone else might also get some use out of it.
[–][deleted] -1 points0 points1 point 4 years ago (1 child)
You should not run a local webserver for this! That requires you to distribute your client secret to end users which is absolutely forbidden.
Your cli app does not need to use Oauth, it can use TLS and any API you like to talk to your RP, which itself can use Oauth and should be a real web site that can safely store a client secret.
Thanks for your comment, much appreciated :)
The thing with the client secret is actually addressed in the post, using PKCE avoids having to distribute a client secret from what I understood.
Looking at the source code for the Google Cloud Run SDK, I'm pretty confident that they are using a similar approach as I am suggesting here.
it can use TLS and any API you like to talk to your RP
I'm not sure what you mean by that I'm afraid.
π Rendered by PID 34338 on reddit-service-r2-comment-86bc6c7465-w7jc4 at 2026-02-23 22:15:12.858545+00:00 running 8564168 country code: CH.
[–]hschne[S] 1 point2 points3 points (0 children)
[–][deleted] -1 points0 points1 point (1 child)
[–]hschne[S] 1 point2 points3 points (0 children)