Skip to main content
Version: 2.x (Latest)

Protocols & Admin API

Added in authorizer-go for Authorizer 2.3.0-rc.9.

Protocol selection​

The user client can talk to the server over three wire protocols. graphql is the default and is 100% backward compatible — existing code keeps working unchanged.

ProtocolTransportNotes
ProtocolGraphQLPOST /graphqlDefault.
ProtocolRESTTyped POST/GET /v1/... routesSame flat responses as GraphQL.
ProtocolGRPCGenerated gRPC stubUses a separate endpoint (default :9091).

Pass WithProtocol to NewAuthorizerClient. As of 2.3.0-rc.9 all 20 public methods work over every protocol, and all three return identical flat response shapes.

// REST (default endpoint, no extra config)
client, err := authorizer.NewAuthorizerClient(
"YOUR_CLIENT_ID", "YOUR_AUTHORIZER_URL", "", nil,
authorizer.WithProtocol(authorizer.ProtocolREST),
)

gRPC​

gRPC listens on its own port, separate from the HTTP URL. When WithGRPCEndpoint is omitted, the target is derived from the Authorizer URL's host with the default gRPC port 9091.

client, err := authorizer.NewAuthorizerClient(
"YOUR_CLIENT_ID", "https://your-instance.authorizer.dev", "", nil,
authorizer.WithProtocol(authorizer.ProtocolGRPC),
authorizer.WithGRPCEndpoint("your-instance.authorizer.dev:9091"), // optional
)
if err != nil {
panic(err)
}

res, err := client.Login(&authorizer.LoginInput{Email: "user@example.com", Password: "Abc@123"})

OAuth endpoints (/oauth/token, /oauth/revoke) always use REST regardless of the selected protocol.

Admin client​

The admin API is a separate client constructed with the admin secret (the value of --admin-secret). Admin auth is sent on every call as the x-authorizer-admin-secret header (gRPC: metadata key x-authorizer-admin-secret).

admin, err := authorizer.NewAuthorizerAdminClient(
"https://your-instance.authorizer.dev", "YOUR_ADMIN_SECRET",
)
if err != nil {
panic(err)
}

// List users
res, err := admin.Users(&authorizerv1.UsersRequest{})
if err != nil {
panic(err)
}
for _, u := range res.Users {
fmt.Println(u.Email)
}

Request/response types come from the generated proto package (authorizerv1 "github.com/authorizerdev/authorizer-go/gen/..."); import it alongside the SDK.

Admin client options​

OptionDescription
WithAdminProtocol(p)Wire transport. Defaults to ProtocolGraphQL.
WithAdminGRPCEndpoint(addr)gRPC target (default: URL host + :9091).
WithAdminExtraHeaders(h)Extra headers sent on every admin request.
admin, err := authorizer.NewAuthorizerAdminClient(
"https://your-instance.authorizer.dev", "YOUR_ADMIN_SECRET",
authorizer.WithAdminProtocol(authorizer.ProtocolGRPC),
authorizer.WithAdminGRPCEndpoint("your-instance.authorizer.dev:9091"),
)

Admin methods​

Each method declares which protocols support it. Calling a method on an unsupported protocol raises a clear error early (e.g. "AdminMeta is not available over graphql") rather than emitting a 404. The protocol columns below also apply to the Python and JS admin clients (JS supports graphql + rest only).

⚠ Destructive: DeleteUser, DeleteWebhook, DeleteEmailTemplate, FgaWriteModel (overwrites the model), FgaDeleteTuples, and FgaReset (wipes all FGA data) permanently change or remove data.

Auth, session & meta​

MethodDescriptiongrpcrestgql
AdminLoginExchange the admin secret for a session.✓✓✓
AdminLogoutEnd the admin session.✓✓
AdminSessionGet the current admin session.✓✓
AdminMetaServer metadata / feature flags.✓✓

Users & access​

MethodDescriptiongrpcrestgql
UsersList users (paginated).✓✓✓
UserGet a single user.✓✓✓
UpdateUserUpdate a user.✓✓✓
DeleteUserDelete a user.✓✓✓
VerificationRequestsList pending verification requests.✓✓✓
RevokeAccessRevoke a user's access.✓✓✓
EnableAccessRe-enable a user's access.✓✓✓
InviteMembersInvite members by email.✓✓✓

Webhooks​

MethodDescriptiongrpcrestgql
AddWebhookCreate a webhook.✓✓✓
UpdateWebhookUpdate a webhook.✓✓✓
DeleteWebhookDelete a webhook.✓✓✓
GetWebhookGet a single webhook.✓✓✓
WebhooksList webhooks.✓✓✓
WebhookLogsList webhook delivery logs.✓✓✓
TestEndpointSend a test event to a webhook.✓✓✓

Email templates​

MethodDescriptiongrpcrestgql
AddEmailTemplateCreate an email template.✓✓✓
UpdateEmailTemplateUpdate an email template.✓✓✓
DeleteEmailTemplateDelete an email template.✓✓✓
EmailTemplatesList email templates.✓✓✓

Audit​

MethodDescriptiongrpcrestgql
AuditLogsList audit logs.✓✓✓

FGA admin​

MethodDescriptiongrpcrestgql
FgaGetModelGet the current FGA model.✓✓
FgaWriteModelWrite/overwrite the FGA model.✓✓✓
FgaWriteTuplesWrite relationship tuples.✓✓✓
FgaDeleteTuplesDelete relationship tuples.✓✓✓
FgaReadTuplesRead relationship tuples.✓✓✓
FgaListUsersList users with a relation to an object.✓✓✓
FgaExpandExpand a relation into its userset.✓✓✓
FgaResetReset all FGA data.✓✓

GraphQL-only extras​

These have no proto / REST / gRPC equivalent and work over GraphQL only:

MethodDescription
AdminSignupBootstrap the first admin.
UpdateEnvUpdate server environment/config.
GenerateJWTKeysGenerate a new JWT signing key pair.