Erlang server stub for the Permit API
The permitio/permit-erlang repository contains an Erlang server stub generated from the Permit API specification with OpenAPI Generator. This page is for Erlang developers who look for a Permit.io client: the repository is a server stub, not a client, so it doesn't call the Permit API and doesn't run permission checks.
What the repository contains
The repository holds a server stub that depends on Cowboy, the Erlang HTTP server. A server stub implements the routes of the Permit API and the handler modules they call, so it serves Permit-shaped requests instead of sending them. Use it as a starting point for an Erlang service that speaks the Permit API shape, not as a way to talk to Permit.
The Erlang SDK is not included in the SDK feature parity table, which covers the SDKs that implement permit.check().
Check permissions from Erlang
To check permissions from Erlang code, send an HTTP POST request to the /allowed endpoint of your policy decision point (PDP) with the user, action, and resource, and read the allow field of the response. For the request and response bodies, see the PDP API reference. To run a PDP, see Run the PDP.
To manage users, tenants, roles, and other policy objects from Erlang, call the Permit API with your environment API key.
Set up the Erlang server stub
The README sets up the stub inside an erlang.mk application. Create the application first:
mkdir http_server && cd http_server
wget https://erlang.mk/erlang.mk
make -f erlang.mk bootstrap bootstrap-rel
Then add the cowboy, jesse, and jsx dependencies to the generated Makefile, copy the generated Erlang files (including the priv folder) into the application, start the stub with openapi_server:start/2, and run make. For the exact Makefile contents and startup steps, see the Getting started section of the permit-erlang README.
Get help with the Erlang SDK
Ask questions and send feedback in the Permit.io Slack community.
Related pages
- Get your API key
- Permit API reference
- PDP API reference for permission checks over HTTP
- Connect your app and run your first permission check with a Node.js, Python, Java, Go, Ruby, or .NET SDK