Skip to content

OmniAuth Strategy for authenticating with Nest via OAuth2

License

Notifications You must be signed in to change notification settings

DriftingShadows/omniauth-nest

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OmniAuth Nest Strategy

Strategy to authenticate with Nest via OAuth2 in OmniAuth

For more details, read the Nest authorization documentation.

Install

Add this to your Gemfile:

gem 'omniauth-nest'

then

bundle install

Example

  1. Clone this repo and cd into it
  2. bundle install (Required bundler gem)
  3. cd examples
  4. Log in to the Nest Developer portal to get your OAuth credentials and to set your redirect URI.
    Set your OAuth client ID and client secret as environment variables:
export NEST_ID='Your OAuth client ID here'
export NEST_SECRET='Your OAuth client secret here'
  1. Set redirect URI to http://localhost:9292/auth/nest/callback
  2. bundle exec rackup
  3. Open http://localhost:9292 in your browser and follow the links

Usage

In Rails add the following to config/initializers/omniauth.rb

use OmniAuth::Builder do
  provider :nest, ENV['NEST_ID'], ENV['NEST_SECRET']
end

This will enable the route /auth/nest which will start the OAuth2 flow. See examples/config.ru for a fully working example.

NOTE: The Nest OAuth2 service only returns authorization tokens for the Nest API, not user identification.

Contributing

Contributions are always welcome and highly encouraged.

See CONTRIBUTING for more information on how to get started.

License

Apache 2.0 - See LICENSE for more information.

About

OmniAuth Strategy for authenticating with Nest via OAuth2

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%