GithubHelp home page GithubHelp logo

ministryofjustice / auth0-golang-kube-app Goto Github PK

View Code? Open in Web Editor NEW

This project forked from djsd123/auth0-golang-kube-app

0.0 3.0 1.0 38 KB

Handles api auth

Go 52.11% PowerShell 0.82% Shell 1.01% CSS 9.57% JavaScript 22.07% HTML 14.43%

auth0-golang-kube-app's Introduction

Auth0 - Go Token Web App

This sample app has been modified to produce an id_token and refresh_token to stdout and your web browser once you've authenticated with Auth0

My use case was for Kubernetes cluster auth, namely Option 1 when configuring OpenID Connect for kubectl

Prerequisites

You'll need an Auth0 account and web client

Auth0 Jargon:

  • Auth0 Regular WebApp client
  • Your client must be authorised in both the management and extensions API
  • The extensions API should have read:user_idp_tokens scope and the Allow Offline Access activated

Required Environments Variables

Values can be found in Auth0 client settings

AUTH0_CLIENT_ID=< client id >
AUTH0_DOMAIN=< domain >
AUTH0_CLIENT_SECRET=< client_secret >
AUTH0_CALLBACK_URL=http://localhost:3000/callback
AUTH0_AUDIENCE=urn:auth0-authz-api

Usage

With Docker

Assuming you have set up a client in Auth0?

You'll need to retrieve values from your Auth0 client for the environment variables listed in the .env file

Once done, simply run the exec.sh/exec.ps1 script and browse to http://localhost:3000 where you can authenticate

Your id_token and refresh_token output can be copy&pasted from the console you ran the exec.sh from or your browser

See refresh_token and id_token docs for more info

or

Use my container and supply your own .env file

docker container run --rm -it --env-file < .env > -p 3000:3000 quay.io/mojanalytics/auth0-golang-kube-app

Without Docker

  • First set the environment variables defined above

  • Run go run main.go server.go

  • Browse to http://localhost:3000

Logout

Remember to Logout to end your session once you have finished.

Troubleshooting

Clearing cookies tends to resolve any unexpected behaviour. Particularly cookies with localhost in the name

Try accessing the app in another browser

auth0-golang-kube-app's People

Contributors

djsd123 avatar xoen avatar

Watchers

 avatar  avatar  avatar

Forkers

uk-gov-mirror

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.