docker compose up -d- TOP: http://localhost:18000/
- ADMIN: http://localhost:18000/admin/
- Keycloak: http://localhost:18080/
docker compose exec billing_infra python manage.py createsuperuserdocker compose exec billing_infra python manage.py migratehttp://localhost:18080/realms/master/.well-known/openid-configuration にブラウザでアクセス
http://localhost:18080/realms/master/protocol/openid-connect/auth?response_type=code&scope=openid&client_id={client_id}&state=abcdefgh&redirect_uri=http://localhost:18000/callback/&nonce=hijklmnoにKeycloakログイン済みのブラウザでアクセスするclient_idはKeycloakの管理画面から確認する- 事前にKeycloakのClientの
redirect_uriにhttp://localhost:18000/callback/を登録しておく必要あり
- 認証リクエストのリダイレクト先URLのクエリーストリングから
codeをコピーして控える client_idとclient_secretはKeycloakの管理画面から確認する
curl -X POST "http://localhost:18080/realms/master/protocol/openid-connect/token" -d "redirect_uri=http://localhost:18000/callback/" -d "grant_type=authorization_code" -d "code={code}" -d "client_id={client_id}" -d "client_secret={client_secret}"| jq -r ".access_token"→ アクセストークンを取得できる
curl -X GET "http://localhost:18000/api/userinfo/" -H "Authorization: {アクセストークン}"