GithubHelp home page GithubHelp logo

isabella232 / omniauth-digitalocean Goto Github PK

View Code? Open in Web Editor NEW

This project forked from digitalocean/omniauth-digitalocean

0.0 0.0 0.0 36 KB

DigitalOcean OAuth2 Strategy for OmniAuth

Home Page: https://github.com/digitaloceancloud/omniauth-digitalocean

License: MIT License

Ruby 100.00%

omniauth-digitalocean's Introduction

DigitalOcean's Omniauth strategy

This is the official Ruby OmniAuth strategy for authenticating to DigitalOcean.

Before you can start developing your API client for DigitalOcean, you need to create an application on your account and copy the application id and secret.

Installation

Add the strategy to your Gemfile:

gem 'omniauth-digitalocean'

And bundle.

Usage

You can integrate the strategy into your middleware in a config.ru:

use OmniAuth::Builder do
  provider :digitalocean, SETTINGS['CLIENT_ID'], SETTINGS['CLIENT_SECRET'], scope: "read write"
end

If you're using Rails, you'll want to add to the middleware stack:

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :digitalocean, SETTINGS['CLIENT_ID'], SETTINGS['CLIENT_SECRET'], scope: "read write"
end
  • The scope needs to be separated by space and not comma: "read write" instead of "read,write" !

For additional information, refer to the OmniAuth wiki.

See the example Sinatra app for full examples

Auth Hash Schema

The following information is provided in the auth hash accessible to the callback at request.env["omniauth.auth"]:

  • provider - The OmniAuth provider, i.e. digitalocean
  • uid - The UUID of the authenticating user
  • info - A hash containing information about the user
    • uuid - The UUID of the authenticating user
    • name - The user's display name
    • email - The e-mail of the authenticating user
    • team_uuid - The UUID of the team when authenticated in a team context
    • team_name - The team's display name when authenticated in a team context
  • credentials - A hash containing authentication information
    • token - The DigitalOcean OAuth access token
    • refresh_token - A refresh token that can be exchanged for a new OAuth access token
    • expires - Boolean indicating whether the access token has an expiry date
    • expires_at - Timestamp of the expiry time
  • extra - Contains extra information returned from the /v2/account endpoint of the DigitalOcean API.
    • droplet_limit - The total number of Droplets current user or team may have active at one time
    • floating_ip_limit - The total number of Floating IPs the current user or team may have
    • email - The email address for the current user
    • uuid - The UUID for the current user.
    • email_verified - If true, the user has verified their account via email
    • status - This value is one of active, warning, or locked
    • status_message - A human-readable message giving more details about the status of the account

License

omniauth-digitalocean is released under the MIT License.

omniauth-digitalocean's People

Contributors

andrewsomething avatar bentranter avatar excid3 avatar foreseaz avatar ivanvanderbyl avatar joonas avatar mchitten avatar phillbaker avatar wwkeyboard avatar

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.