diff --git a/README.md b/README.md index ef33d2181..1bbc8b51e 100644 --- a/README.md +++ b/README.md @@ -77,23 +77,26 @@ docker run -p 8080:8080 -it --name login-ui --rm localhost:32000/identity-platfo ## Development setup -As a requirement, please make sure to have `docker` and `docker-compose` installed as well as a set of client credentials for AzureAD. +As a requirement, please make sure to have `docker` and `docker-compose` installed. -Create a file called `.env` on the root of the repository and paste your client credentials: +You need to have a registered Github OAuth application to use for logging in. +To register a Github OAuth application: +1) Go to https://github.com/settings/applications/new. The application name and homepage URL do not matter, but the Authorization callback URL must be `http://localhost:4433/self-service/methods/oidc/callback/github`. +2) Generate a client secret +3) Create a file called `.env` on the root of the repository and paste your client credentials: -``` +```text CLIENT_ID= CLIENT_SECRET= -MICROSOFT_TENANT= ``` -We are going to use docker-compose to run Kratos, Hydra and OpenFGA: +Run the login UI's dependencies: ```console docker-compose -f docker-compose.dev.yml up -- build --force-recreate ``` -Now we can run the UI: +Run the Login UI: ```console export KRATOS_PUBLIC_URL=http://localhost:4433 export HYDRA_ADMIN_URL=http://localhost:4445 @@ -101,8 +104,28 @@ export BASE_URL=http://localhost:4455 export PORT=4455 export TRACING_ENABLED=false export LOG_LEVEL=debug -export OPENFGA_API_SCHEME=http -export OPENFGA_API_HOST=localhost:8080 -export OPENFGA_STORE_ID=01GP1254CHWJC1MNGVB0WDG1T0 +export AUTHORIZATION_ENABLED=false go run cmd/main.go ``` + +To test the authorizatoin code flow you can use the Ory Hydra CLI: + +> To install the Ory Hydra CLI follow the instruction at https://www.ory.sh/docs/hydra/self-hosted/install. + +```console +code_client=$(hydra create client \ + --endpoint http://localhost:4445 \ + --name grafana \ + --grant-type authorization_code,refresh_token \ + --response-type code \ + --format json \ + --scope openid,offline_access,email,profile \ + --redirect-uri http://127.0.0.1:4446/callback \ + --audience app_client \ +) +hydra perform authorization-code \ + --endpoint http://localhost:4444 \ + --client-id `echo "$code_client" | yq .client_id` \ + --client-secret `echo "$code_client" | yq .client_secret` \ + --scope openid,profile,email,offline_access +```