#access-token #okta #user-name #password #openid #scope

bin+lib auth_token

Get an auth token to use in development

1 unstable release

0.2.3 Oct 10, 2022
0.2.2 Oct 10, 2022
0.2.1 Oct 10, 2022
0.2.0 Oct 10, 2022

#913 in Authentication

MIT license

60KB
578 lines

auth-token

Summary

A small CLI application and rust library, that allows you to get an auth token for use in development.

Screenshot

Binary Releases

See Github Releases

Example

# Get an OKTA Access Token
$ auth-token  okta-access-token
             --client-id XXXXyyyy
             --base-url https://myapp.okta.com/ 
             --authorization-server-id abc123
             --login-redirect-url http://myapp/callback 
             --username my.user 
             --copy-to-clipboard

🎉 auth-token - A CLI tool to get an auth token for use in development.
Password? (hidden) 

🔐 Getting Access Token for my.user

✅ Token Copied To Clipboard

eyJra....

Usage

auth-token command --flags

# Commands
okta-access-token

# Flags
--base-url https://myapp.okta.com/
--client-id XXXXyyyy
--authorization-server-id abc123
--login-redirect-url http://myapp/callback
--scopes 'openid profile email'
--username my.user
--password pa$sw0rd
--copy-to-clipboard
--print-token-json

Setting up on Mac

Download the release from Github Releases and copy to your home directory.

Run the file once by using right click / option click -> run, to approve the binary through gatekeeper.

Add a command to the end of your ~/.zshrc file:

alias token="auth-token okta-auth-token --client-id=XXXXyyyy --base-url=https://myapp.okta.com/ --login-redirect-url=http://myapp/callback --scopes='openid profile email groups' --username=my.user --copy-to-clipboard"

Open a new terminal, and run token!

Limitations

  • Binary Releases are not notarized yet, so we can't create an install script.
  • Only basic auth (user/password) is implemented.
  • Only the following modes are impemented:
    • code_challenge_method: S256
    • response_type: code
    • response_mode: form_post
    • prompt: none
    • grant_type: authorization_code
  • Error codes are not read from some endpoints, instead a generic error is returned.

Build Source

rustup must already be installed - https://www.rust-lang.org/tools/install

# Build for your own platform
make

# Install cross-compilation chains if not already done.
# mingw-w64 is also required to build a windows target.
make install-toolchains 

# Build for other platforms
make build-mac-aarch64
make build-mac
make build-win
make build-linux
make build-linux-musl

Codesign and Notarize

We are using gon to assist in codesign and notarization. Run the following command from the project root directory.

BUNDLE_ID=your.bundle.id AC_USERNAME=apple.connect.username AC_PASSWORD=app.specific.password gon gon_config.json

Dependencies

~13–26MB
~377K SLoC