Service responsible for handling OAuthentication.
User API
{
"email": "[email protected]",
"password": "123abc"
}
OAuth API:
{
"grant_type": "password",
"username": "[email protected]",
"password": "123abc"
}
{
"grant_type": "client_credentials",
"client_id": "id-123",
"client_secret": "secret-123"
}
sudo docker-compose up --build
sudo docker-compose up -d (daemon mode)
sudo docker-compose up --remove-orphans
cd src/domain/access_token
go test
go test --cover
The docker exec command allows you to run commands inside a Docker container. The following command line will give you a bash shell inside your cassandra container:
docker exec -it go-oauth-cassandra-db bash
cqlsh
The Cassandra Server log is available through Docker's container log:
docker logs go-oauth-cassandra-db
Inside Cassandra:
describe keyspaces;
CREATE KEYSPACE oauth WITH REPLICATION = {'class':'SimpleStrategy','replication_factor':1}
describe keyspaces;
USE oauth;
CREATE TABLE access_token(access_token varchar PRIMARY KEY, user_id bigint, client_id bigint, expires bigint);
SELECT * FROM access_token where access_token='example';
go mod tidy ---> https://blog.golang.org/using-go-modules
The go mod tidy command cleans up these unused dependencies:
go mod init github.com/aipetto/go-aipetto-users-api
go clean -modcache
-[ ] Check Cassandra settings, message on local logs:
go-oauth-cassandra-db | WARN [main] 2021-01-31 02:54:59,864 StartupChecks.java:311 - Maximum number of memory map areas per process (vm.max_map_count) 65530 is too low, recommended value: 1048575, you can change it with sysctl.
go-oauth-api exited with code 2