Databases
Supported Databases
Authorizer v2 configures the database via CLI flags. The required flags are --database-type and --database-url.
-
--database-type=postgres --database-url="postgres://username:password@localhost:5432/postgres" -
--database-type=yugabyte --database-url="postgres://username:password@localhost:5432/postgres" -
--database-type=postgres --database-url="postgres://username:password@localhost:5432/postgres" -
--database-type=mysql --database-url="username:password@tcp(localhost:port)/database_name" -
--database-type=planetscale --database-url="username:password@tcp(localhost:port)/database_name" -
--database-type=mariadb --database-url="username:password@tcp(localhost:port)/database_name" -
--database-type=sqlite --database-url=test.db -
--database-type=sqlserver --database-url="sqlserver://gorm:LoremIpsum86@localhost:9930?database=gorm" -
--database-type=mongodb --database-url="mongodb://localhost:27017" --database-name=authorizer -
--database-type=arangodb --database-url="https://root:password@localhost.arangodb.cloud:8529" --database-name=authorizer -
--database-type=cassandradb \
--database-host="db-connection-string" \
--database-username="test" \
--database-password="*********" \
--database-cert="Base64 encoded cert string" \
--database-cert-key="Base64 encoded cert key" \
--database-ca-cert="Base64 encoded CA cert"Note for CassandraDB: If using a cloud provider like DataStax, they don't allow creating
keyspace. Please create akeyspacenamedauthorizerfrom their GUI. -
--database-type=scylladb \
--database-host="192.168.0.1,192.168.0.2,192.168.0.3" \
--database-username="scylladb" \
--database-password="*********" -
--database-type=dynamodb \
--aws-region=ap-south-1 \
--aws-access-key-id=YOUR_ACCESS_KEY \
--aws-secret-access-key=YOUR_SECRET -
--database-type=couchbase \
--database-url="couchbase://127.0.0.1" \
--database-username="admin" \
--database-password="*********" \
--couchbase-bucket="authorizer" \
--couchbase-bucket-ram-quota=1000 \
--couchbase-scope="_default"
Note: For MongoDB and ArangoDB, use
--database-namesince the database name is not part of the connection URL.
Tables / Collections
Authorizer creates and manages the following tables/collections:
authorizer_users-- stores basic user informationauthorizer_verification_requests-- stores email verification and forgot password requestsauthorizer_sessions-- stores user sessions
Session Store
For each request requiring authorization, Authorizer validates the HTTP Cookie or Authorization header. To improve throughput, an in-memory store is used.
Authorizer supports two session stores:
- Redis -- configured via
--redis-url. Persisted as long as Redis is running. - In-memory -- default when no Redis URL is set. Not recommended for production.
Example with Redis:
./build/server \
--database-type=sqlite \
--database-url=test.db \
--jwt-type=HS256 \
--jwt-secret=test \
--admin-secret=admin \
--client-id=123456 \
--client-secret=secret \
--redis-url=redis://localhost:6379