https://github.com/magiclabs/magic-admin-ruby
Magic admin Ruby SDK makes it easy to leverage Decentralized ID tokens to protect routes and restricted resources for your application.
https://github.com/magiclabs/magic-admin-ruby
authentication identity passwordless ruby
Last synced: 7 months ago
JSON representation
Magic admin Ruby SDK makes it easy to leverage Decentralized ID tokens to protect routes and restricted resources for your application.
- Host: GitHub
- URL: https://github.com/magiclabs/magic-admin-ruby
- Owner: magiclabs
- License: mit
- Created: 2020-08-11T17:10:25.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-07-10T20:47:25.000Z (over 2 years ago)
- Last Synced: 2024-11-24T08:32:50.115Z (about 1 year ago)
- Topics: authentication, identity, passwordless, ruby
- Language: Ruby
- Homepage: https://docs.magic.link/admin-sdk/ruby
- Size: 409 KB
- Stars: 10
- Watchers: 19
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Magic Admin Ruby SDK
The Magic Admin Ruby SDK provides convenient ways for developers to interact with Magic API endpoints and an array of utilities to handle [DID Token](https://magic.link/docs/introduction/decentralized-id).
## Table of Contents
* [Documentation](#documentation)
* [Quick Start](#quick-start)
* [Changelog](#changelog)
* [License](#license)
## Documentation
See the [Magic doc](https://magic.link/docs/api-reference/server-side-sdks/ruby)!
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'magic-admin'
```
And then execute:
```bash
$ bundle
```
Or install it yourself as:
```bash
$ gem install magic-admin
```
### Prerequisites
- Ruby 2.5+
## Quick Start
Before you start, you will need an API secret key. You can get one from the [Magic Dashboard](https://dashboard.magic.link/). Once you have the API secret key, you can instantiate a Magic object.
```ruby
require 'magic-admin'
magic = Magic.new(api_secret_key: '')
magic.token.validate('DID_TOKEN')
# Read the docs to learn more! 🚀
```
Optionally if you would like, you can load the API secret key from the environment variable, `MAGIC_API_SECRET_KEY`.
```ruby
# Set the env variable `MAGIC_API_SECRET_KEY`.
magic = Magic.new
```
**Note**: The arguments passed to the `Magic` object takes precedence over the environment variables.
### Configure Network Strategy
The `Magic` object also takes in `retries`, `timeout` and `backoff` as optional arguments at the object instantiation time so you can override those values for your application setup.
```ruby
magic = Magic.new(retries: 5, timeout: 10, backoff: 0.03)
```
## Changelog
See [Changelog](CHANGELOG.md)
## License
See [License](LICENSE.txt)