Coder Social home page Coder Social logo

descope / descopecli Goto Github PK

View Code? Open in Web Editor NEW
87.0 10.0 0.0 118 KB

A command line utility for performing common tasks on Descope projects

Home Page: https://docs.descope.com

License: MIT License

Makefile 4.85% Go 94.98% Dockerfile 0.17%
authentication authorization cli descope

descopecli's Introduction

Descope Logo

Descope CLI

A command line tool for managing your Descope project


About

The descope command line tool provides a convenient way to perform common tasks on your Descope project by leveraging Descope's management APIs.

  • Create and modify project entities such as users, tenants and access keys.
  • Manage project settings and configurations using snapshots that can be exported, validated and imported into other projects.
  • Search and display audit logs for projects.
  • Supports JSON output for easy integration into scripts and CI/CD workflows.

Installation

All Platforms

The descope tool is available as a downloadable binary from the releases page.

Debian/Ubuntu

Install descope using APT:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys e8365d8513142909
echo "deb https://descope.github.io/packages stable main" | sudo tee /etc/apt/sources.list.d/descope.list
sudo apt-get update
sudo apt-get install descope

Fedora/CentOS

You can install descope using DNF by adding the Descope repository:

sudo dnf config-manager --add-repo https://descope.github.io/packages/descope.repo
sudo dnf install descope

Build from Source

You can build the descope command line tool directly with the go compiler:

  1. Verify that you have Go 1.21 or newer installed, and if not, follow the instructions on the Go website:

    go version
  2. Clone or download the repository:

    git clone https://github.com/descope/descopecli
    cd descopecli
  3. Install descope with make install:

    # installs to $GOPATH/bin by default
    make install

Getting Started

Requirements

  • The Descope project's Project ID is required by descope to know which project to work with. You can find it in the Project section in the Descope console.
  • You'll also need a valid Descope management key for the above project. You can create a management key in the Company section in the Descope console.

Usage

All descope commands expect the Descope management key to be provided in the DESCOPE_MANAGEMENT_KEY environment variable. You'll have to provide your Descope project's unique id either in the DESCOPE_PROJECT_ID environment variable or as a command argument, depending on the command.

export DESCOPE_PROJECT_ID='P...'
export DESCOPE_MANAGEMENT_KEY='K...'
descope --help
A command line utility for working with the Descope management APIs

Usage:
  descope [command]

Entity Commands:
  access-key  Commands for creating and managing access keys
  tenant      Commands for creating and managing tenants
  user        Commands for creating and managing users

Project Commands:
  audit       Commands for working with audit logs
  project     Commands for managing projects

Additional Commands:
  completion  Generate the autocompletion script for the specified shell
  help        Help about any command

Examples

Tenants

Create a tenant

# creates a new tenant with a predefined tenantId
descope tenant create 'AcmeCorp' --id 'acmecorp'
* Created new tenant with id: acmecorp

List all tenants

# use the --json option to get structured JSON output from any command
descope tenant load-all --json
{
    "count": 1,
    "ok": true,
    "tenants": [
        {
            "id": "acmecorp",
            "name": "AcmeCorp",
            "selfProvisioningDomains": [],
            "authType": "none"
        }
    ]
}

Users

Create a user in a tenant

# creates a user and sends them an invitation if configured in the Descope console
descope user create '[email protected]' --name 'Andy Rhoads' -t 'acmecorp' --json
{
    "ok": true,
    "user": {
        "name": "Andy Rhoads",
        "email": "[email protected]",
        "userId": "U2eY8ZRNUlC9IKqLGzmAww7qgK0T",
        "loginIds": ["[email protected]"],
        "verifiedEmail": true,
        "userTenants": [
            {
                "tenantId": "acmecorp",
                "tenantName": "AcmeCorp"
            }
        ],
        "status": "invited",
        "createdTime": 1712070205
    }
}

List all users

# returns a page of user results
descope user load-all --limit 10 --page 0
* Loaded 3 users
  - User 0: { "name": ... }
  - User 1: { "name": ... }
  - User 2: { "name": ... }

Project

Manage project settings

# to prevent mistakes some project commands require the projectId as
# an argument, rather than as an environment variable

# export a snapshot of all the project's settings and configurations
descope project snapshot export 'P2abc...' --path ./descope_export

# import the exported snapshot from the first project into another project
descope project snapshot import 'P2xyz...' --path ./descope_export

Search audit records

# searches for any audit records about the user we created above
descope audit search 'andyr' --json
{
    "count": 1,
    "ok": true,
    "records": [
        {
            "action": "UserCreated",
            "loginIds": ["[email protected]"]
        }
    ]
}

Support

Contributing

If anything is missing or not working correctly please open an issue or pull request.

Learn more

To learn more please see the Descope documentation.

Contact us

If you need help you can hop on our Slack community or send an email to Descope support.

descopecli's People

Contributors

descope[bot] avatar omercnet avatar shilgapira avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

descopecli's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Repository problems

Renovate tried to run on this repository, but found these problems.

  • WARN: File contents are invalid JSON but parse using JSON5. Support for this will be removed in a future release so please change to a support .json5 file name or ensure correct JSON syntax.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/actions/ci/leaks/action.yml
  • gitleaks/gitleaks-action v2
.github/actions/ci/lint/action.yml
  • golangci/golangci-lint-action v6
.github/actions/ci/setup/action.yml
  • actions/cache v4
.github/actions/export/action.yml
.github/actions/import/action.yml
.github/actions/install/action.yml
  • actions/cache v4
.github/workflows/ci.yml
  • actions/checkout v4
  • actions/checkout v4
  • actions/checkout v4
.github/workflows/release.yml
  • actions/checkout v4
  • sigstore/cosign-installer v3
  • docker/login-action v3
  • goreleaser/goreleaser-action v6
  • actions/upload-artifact v4
  • actions/checkout v4
  • actions/download-artifact v4
  • crazy-max/ghaction-import-gpg v6
gomod
go.mod
  • github.com/descope/go-sdk v1.6.6-0.20240807171053-8a6c2c5fa043@8a6c2c5fa043
  • github.com/spf13/cobra v1.8.1
  • golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3@2c58cdc269a3

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.