Development

Oso provides a set of developer tools to streamline the development process.

Install the VS Code extension

If you use VS Code, install the Oso Extension. This will also install the Oso Cloud CLI. The extension features include:

  • Polar syntax highlighting
  • Errors and warning from Oso policies
  • Run policy tests from the code pane

Install the Oso Cloud CLI

If you didn't install the VS Code extension, you can install the Oso Cloud CLI manually by following the instructions for your operating system.

The Oso Cloud CLI provides console integration for Oso Cloud. Once it's installed, you can:

  • Validate Polar syntax oso-cloud validate
  • Run policy tests oso-cloud test
  • Deploy policies to Oso Cloud or the Oso Dev Server oso-cloud policy
  • Generate typescript types from your policy oso-cloud generate-types

On Windows, the command is oso_cli (e.g. oso_cli validate)

The CLI provides many other instructions. See the CLI page for complete documentation.

Install the Oso Dev Server

The Oso Dev Server is a local instance of Oso Cloud that you can use to test authorization-dependent application logic without the need for communicating with the remote Oso Cloud service.

Install the latest version of the Oso Dev Server from the install page (opens in a new tab) in the Oso Cloud UI.

We currently provide the Oso Dev Server for Mac OS and Linux. On Windows, you can run the Oso Dev Server in a Docker image by using the Dockerfile provided on the install page (opens in a new tab).

Configure your local environment to use the Oso Dev Server

Once you've installed the Oso Dev Server, configure your system to use it:

CLI

  • Set the OSO_URL environment variable to http://localhost:8080
  • Set the OSO_AUTH environment variable to e_0123456789_12345_osotesttoken01xiIn

Client SDK

Consult the API documentation to find the instructions for initializing the client with the local URL and API token.

For example, you would instantiate the Node.js client as follows:


const { Oso } = require("oso-cloud");
const oso = new Oso(
"http://localhost:8080",
"e_0123456789_12345_osotesttoken01xiIn"
);

See Use the Oso Dev Server for comprehensive documentation about the Oso Dev Server.

Next Steps

Now that you've installed the developer tools, you can use them to build a powerful local development workflow. Read the workflow walkthrough to learn how.