A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/cadenza-tech/omniauth-line-v2_1 below:

cadenza-tech/omniauth-line-v2_1: LINE strategy for OmniAuth.

LINE strategy for OmniAuth.

Install the gem and add to the application's Gemfile by executing:

bundle add omniauth-line-v2_1

If bundler is not being used to manage dependencies, install the gem by executing:

gem install omniauth-line-v2_1
Rails Configuration with Devise

Add the following to config/initializers/devise.rb:

# config/initializers/devise.rb
Devise.setup do |config|
  config.omniauth :line_v2_1, ENV['LINE_CHANNEL_ID'], ENV['LINE_CHANNEL_SECRET']
end

Add the OmniAuth callbacks routes to config/routes.rb:

# config/routes.rb
Rails.application.routes.draw do
  devise_for :users, controllers: { omniauth_callbacks: 'users/omniauth_callbacks' }
end

Add the OmniAuth configuration to your Devise model:

class User < ApplicationRecord
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :validatable,
         :omniauthable, omniauth_providers: [:line_v2_1]
end

You can configure several options:

# config/initializers/devise.rb
Devise.setup do |config|
  config.omniauth :line_v2_1, ENV['LINE_CHANNEL_ID'], ENV['LINE_CHANNEL_SECRET'],
    {
      scope: 'profile openid', # Specify OAuth scopes
      callback_path: '/custom/line_v2_1/callback', # Custom callback path
      prompt: 'consent', # Optional: force consent screen
      bot_prompt: 'aggressive' # Optional: LINE official account linking
    }
end

Available scopes:

After successful authentication, the auth hash will be available in request.env['omniauth.auth']:

{
  provider: 'line_v2_1',
  uid: 'U4af4980629...',
  info: {
    name: 'Taro Line',
    nickname: 'U4af4980629...',
    image: 'https://profile.line-scdn.net/...',
    email: 'taro.line@example.com'
  },
  credentials: {
    token: 'bNl4YEFPI/hjFWhTqexp4MuEw5YPs...',
    expires: true,
    expires_at: 1504169092,
    refresh_token: 'Aa1FdeggRhTnPNNpxr8p'
  },
  extra: {
    raw_info: {
      sub: 'U4af4980629...',
      name: 'Taro Line',
      picture: 'https://profile.line-scdn.net/...'
    },
    id_token: 'eyJhbGciOiJIUzI1NiJ9...',
    id_info: {
      iss: 'https://access.line.me',
      sub: 'U4af4980629...',
      aud: '1234567890',
      exp: 1504169092,
      iat: 1504263657,
      auth_time: 1504263657,
      nonce: '0987654asdf',
      amr: ['pwd'],
      name: 'Taro Line',
      picture: 'https://profile.line-scdn.net/...',
      email: 'taro.line@example.com'
    }
  }
}

See CHANGELOG.md.

Bug reports and pull requests are welcome on GitHub at https://github.com/cadenza-tech/omniauth-line-v2_1. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

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

Everyone interacting in the OmniauthLineV2.1 project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

You can sponsor this project on Patreon.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4