The OAuth2l Authentication Playground is a web application where users can interact with the OAuth2l CLI tool using a GUI. Its primary use is to allow developers to interactively experiment with all the authentication flows and tokens supported in GCP.
The Authentication Playground was designed to provide an intuitive and functional interface that will improve the experience for users interested in using the OAuth2l without being restricted to the CLI. The application is built on top of the OAuth2l, which allows it to inherit all its functionality and be adapted to fit future updates as well.
This application is built using React.JS on the frontend, themed with the Material-UI library and uses Go for the backend.
First clone the repository using the following command:
$ git clone https://github.com/googleinterns/oauth2l-webThen go into the web directory in your oauth2l-web directory.
$ cd oauth2l-web/webDownload Docker if not already installed.
Create the images for the backend and the frontend by running the following command:
$ docker-compose up -d --buildThe application should then be running on http://localhost:3000.
To stop the application, run the following commands:
$ docker-compose stop
$ docker-compose rm -fFor the frontend, go into the web/client folder. For the backend, go into the web/api folder. Then to build the image, run the following command:
$ docker build -t oauth2l-web-<frontend/backend>Then run the image with the following command:
$ docker run --detach --name oauth2l-web-frontend -p 3000:3000 -d oauth2l-web-frontend #frontend
$ docker run --detach --name oauth2l-web-backend -p 8080:8080 -d oauth2l-web-backend #backendTo stop the image, run the following command
$ docker container stop oauth2l-web-<frontend/backend>
$ docker container rm oauth2l-web-<frontend/backend>The requirements needed to run the web application are:
| Requirements | Link |
|---|---|
| Node | https://nodejs.org/en/ |
| npm | https://www.npmjs.com/get-npm |
| Golang | https://golang.org/dl/ |
| OAuth2l | https://github.com/google/oauth2l |
Go into your web/api directory and install the go libraries used in the application.
$ cd web/api
$ go get .Then go into the web/client directory and install the libaries used for the front-end.
$ cd web/client
$ npm installTo run the application, go into the web/api directory and run the two files backend.go and wrapper.go.
$ go run backend.go wrapper.goThen, in a separate terminal, go into the web/client directory and then start the react app.
$ npm startA webpage with the address localhost:3000 should appear in a web browser page with the application running.
The unit tests for the frontend are written using Jest.
To run the tests, first go into the web/client directory and run the following command:
$ npm run testThe unit for the backend are written using Go's libraries, testing and httptest.
To run the tests, first go into the web/api directory and run the following command:
$ go test