项目作者: pupi94

项目描述 :
omniauth aliexpress oauth2
高级语言: Ruby
项目地址: git://github.com/pupi94/omniauth-aliexpress-oauth2.git
创建时间: 2020-05-23T10:17:26Z
项目社区:https://github.com/pupi94/omniauth-aliexpress-oauth2

开源协议:MIT License

下载


OmniAuth Aliexpress

Aliexpress OAuth2 Strategy for OmniAuth

Installation

Add to your Gemfile:

  1. gem 'omniauth-aliexpress-oauth2'

Then bundle install.

Usage

OmniAuth::Strategies::Aliexpress is simply a Rack middleware. Read the OmniAuth docs for detailed instructions.

Here’s a quick example, adding the middleware to a Rails app in config/initializers/omniauth.rb:

  1. Rails.application.config.middleware.use OmniAuth::Builder do
  2. provider :aliexpress, ENV['API_KEY'], ENV['APP_SECRET']
  3. end

Authenticate the user by having them visit /auth/aliexpress. For example:

  1. <a href="/auth/aliexpress">Authenticate</a>

Authentication Hash

Here’s an example Authentication Hash available in request.env['omniauth.auth']:

  1. {
  2. provider: 'aliexpress',
  3. credentials: {
  4. token: "token",
  5. refresh_token: "refresh token",
  6. expires_at: 1590227513,
  7. refresh_token_expires_at: 1590227513
  8. },
  9. info: {
  10. user_nick: "user nick",
  11. user_id: "user id",
  12. locale: "locale",
  13. sp: "sp"
  14. },
  15. extra: {
  16. w1_expires_at: 1590227513,
  17. w2_expires_at: 1590227513,
  18. r1_expires_at: 1590227513,
  19. r2_expires_at: 1590227513
  20. }
  21. }

License

The gem is available as open source under the terms of the MIT License.