项目作者: fnando

项目描述 :
Wordpress's OAuth2 Strategy for OmniAuth.
高级语言: Ruby
项目地址: git://github.com/fnando/omniauth-wp.git
创建时间: 2020-01-14T00:54:01Z
项目社区:https://github.com/fnando/omniauth-wp

开源协议:MIT License

下载


Omniauth::Wordpress

Travis-CI
CodeClimate
Test Coverage
Gem
Gem

Wordpress‘s OAuth2 Strategy for OmniAuth.

Installation

Add this line to your application’s Gemfile:

  1. gem 'omniauth-wp'

And then execute:

  1. $ bundle

Or install it yourself as:

  1. $ gem install omniauth-wp

Usage

OmniAuth::Strategies::Wordpress is simply a Rack middleware. Read the OmniAuth docs for detailed instructions: https://github.com/intridea/omniauth.

First, create a new application at https://developer.wordpress.com/apps/. Your callback URL must be something like https://example.com/auth/wordpress/callback. For development you can use http://127.0.0.1:3000/auth/wordpress/callback.

Here’s a quick example, adding the middleware to a Rails app in config/initializers/omniauth.rb. This example assumes you’re exporting your credentials as environment variables.

  1. Rails.application.config.middleware.use OmniAuth::Builder do
  2. provider :wordpress,
  3. ENV['WORDPRESS_CLIENT_ID'],
  4. ENV['WORDPRESS_CLIENT_SECRET']
  5. end

Now visit /auth/wordpress to start authentication against Wordpress.

Contributing

  1. Fork omniauth-wp
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request