Giter Site home page Giter Site logo

goit's Introduction

goit

Get a OIDC token from your terminal.

hydrun CI Go Reference Matrix Binary Downloads

Overview

goit is a tool to quickly get a OpenID Connect token from your terminal, e.g. to use it for API authentication.

Installation

Static binaries are available on GitHub releases.

On Linux, you can install them like so:

$ curl -L -o /tmp/goit "https://github.com/pojntfx/goit/releases/latest/download/goit.linux-$(uname -m)"
$ sudo install /tmp/goit /usr/local/bin

On macOS, you can use the following:

$ curl -L -o /tmp/goit "https://github.com/pojntfx/goit/releases/latest/download/goit.darwin-$(uname -m)"
$ sudo install /tmp/goit /usr/local/bin

On Windows, the following should work (using PowerShell as administrator):

PS> Invoke-WebRequest https://github.com/pojntfx/goit/releases/latest/download/goit.windows-x86_64.exe -OutFile \Windows\System32\goit.exe

You can find binaries for more operating systems and architectures on GitHub releases.

Usage

You can get the OIDC token by running goit; if you have a browser available, it will launch it for you to authorize, and if not will print an authorization URL in the console:

$ goit --oidc-client-id='Ab7OLrQibhXUzKHGWYDFieLa2KqZmFzb' --oidc-issuer='https://pojntfx.eu.auth0.com/' --oidc-redirect-url='http://localhost:11337'
2022/04/24 13:54:44 Successfully got the following OIDC access token:
ayJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IlFtSXdJNVprRjasfasdfadf9.eyJpc3MiOiJodHRwczovL3Bvam50ZnguZXUuYXV0aDAuY29tLyIsInN1YiI6ImF1dGgwfDYyMzgxZTRkN2I3ZGE5MDA2YmQ1NzA5MCIsImF1ZCI6IkFiN09MclFpYmhYVXpLSEdXWURGaWVMYTJLcVptRnpiIiwiaWF0IjoxNjUwODAxMjg0LCJleHAiOjE2NTA4MzcyODR9.h7mXPs0gWQVZao_TyZu7VN1mUReJYBitnMKfgVHE6cLjN-TQX3tRwrasdfsdf-patqRWlBKDZZVuul1WZnArYHHywbzSYMThUfGRlif_QVNNzH2wNVuF_9rjcrVHDcjGZ0Wdta28tPRjSTfKjB6OAeK_8a8gxbk9XJ_tk8bYZfN-4HvyRl_Xrrd-xlMAZm60euNmzd9f3w

It is also possible to export the token to a environment variable like so:

$ export OIDC_CLIENT_ID='Ab7OLrQibhXUzKHGWYDFieLa2KqZmFzb' OIDC_ISSUER='https://pojntfx.eu.auth0.com/' OIDC_REDIRECT_URL='http://localhost:11337'
$ export API_KEY="$(goit)"
2022/04/24 13:57:40 Successfully got the following OIDC access token:
$ echo "${API_KEY}"
ayJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IlFtSXdJNVprRjasfasdfadf9.eyJpc3MiOiJodHRwczovL3Bvam50ZnguZXUuYXV0aDAuY29tLyIsInN1YiI6ImF1dGgwfDYyMzgxZTRkN2I3ZGE5MDA2YmQ1NzA5MCIsImF1ZCI6IkFiN09MclFpYmhYVXpLSEdXWURGaWVMYTJLcVptRnpiIiwiaWF0IjoxNjUwODAxMjg0LCJleHAiOjE2NTA4MzcyODR9.h7mXPs0gWQVZao_TyZu7VN1mUReJYBitnMKfgVHE6cLjN-TQX3tRwrasdfsdf-patqRWlBKDZZVuul1WZnArYHHywbzSYMThUfGRlif_QVNNzH2wNVuF_9rjcrVHDcjGZ0Wdta28tPRjSTfKjB6OAeK_8a8gxbk9XJ_tk8bYZfN-4HvyRl_Xrrd-xlMAZm60euNmzd9f3w

๐Ÿš€ That's it! We hope you enjoy using goit.

Be sure to check out the reference for more information.

Reference

Command Line Arguments

$ goit --help
Get a OIDC token from your terminal.

Find more information at:
https://github.com/pojntfx/goit

Usage:
  goit [flags]

Flags:
  -h, --help                       help for goit
      --oidc-client-id string      OIDC Client ID (i.e. myoidcclientid) (can also be set using the OIDC_CLIENT_ID env variable)
      --oidc-issuer string         OIDC Issuer (i.e. https://pojntfx.eu.auth0.com/) (can also be set using the OIDC_ISSUER env variable)
      --oidc-redirect-url string   OIDC Redirect URL (default "http://localhost:11337")
  -v, --verbose                    Enable verbose logging

Environment Variables

All command line arguments described above can also be set using environment variables; for example, to set --oidc-client-id to myclientid with an environment variable, use OIDC_CLIENT_ID=myclientid.

Acknowledgements

  • coreos/go-oidc provides the OpenID Connect library for goit.
  • All the rest of the authors who worked on the dependencies used! Thanks a lot!

Contributing

To contribute, please use the GitHub flow and follow our Code of Conduct.

To build goit locally, run:

$ git clone https://github.com/pojntfx/goit.git
$ cd goit
$ make depend
$ make
$ out/goit

Have any questions or need help? Chat with us on Matrix!

License

goit (c) 2022 Felicitas Pojtinger and contributors

SPDX-License-Identifier: AGPL-3.0

goit's People

Contributors

pojntfx avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.