Skip to content
This repository has been archived by the owner on Mar 22, 2024. It is now read-only.
/ workos-elixir Public archive
forked from workos/workos-elixir

[BETA] Official Elixir SDK for interacting with the WorkOS API

License

Notifications You must be signed in to change notification settings

teamwalnut/workos-elixir

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Note: this SDK is currently in beta and breaking changes may occur. Please create an issue if you come across a bug.

WorkOS Elixir Library

The WorkOS library for Elixir provides convenient access to the WorkOS API from applications written in Elixir.

Documentation

See the API Reference for Elixir usage examples.

Installation

Add this package to the list of dependencies in your mix.exs file:

def deps do
  [{:workos, "~> 0.1.2"}]
end

The hex package can be found here: https://hex.pm/packages/workos

Configuration

The WorkOS API relies on two configuration parameters, the client_id and the api_key. There are two ways to configure these values with this package.

Recommended Method

In your config/config.exs file you can set the :client_id and :api_key scoped to :workos to be used globally by default across the SDK:

config :workos,
  client_id: "project_12345"
  api_key: "sk_12345",

Ideally, you should use environment variables to store protected keys like your :api_key like so:

config :workos,
  client_id: System.get_env("WORKOS_CLIENT_ID"),
  api_key: System.get_env("WORKOS_API_KEY")

Opts Method

Alternatively, you can override or avoid using these globally configured variables by passing a :api_key or :client_id directly to SDK methods via the optional opts parameter available on all methods:

WorkOS.SSO.get_authorization_url(%{
  domain: "workos.com",
  redirect_uri: "https://workos.com"
}, [
  client_id: "project_12345",
  api_key: "sk_12345"
])

This is great if you need to switch client IDs on the fly.

More Information

About

[BETA] Official Elixir SDK for interacting with the WorkOS API

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Elixir 100.0%