-
Download the LINE mobile app and register using your mobile number.
-
Under Settings -> Account:
- Complete Email Registration by setting an email id and password.
- Enable Allow Login.
-
Now visit Business Center. Click on Start using LINE Login.
-
Under Create an Account, enter email to be used for Business Center. An email will be sent with the registration URL. Click on that URL to verify your email.
-
Enter more details of your business:
- Profile Information:
- Enter Mobile Number
- Enterprise Information:
- Select Enterprise Type as Corporation
- Enter other details
- Click Continue.
- Profile Information:
-
On next page, under Accounts -> Your Accounts, click on Start Using Service -> Line Login.
-
Next, click on Start using LINE Login.
-
Set Business Account Name.
-
Under Channel Information:
- Enter Channel Description
- Select Application Type as Web
- Enter Email Address
- Click OK.
-
On next page, click Apply. Note down the CHANNEL_ID.
-
Now, click on Line Developers.
-
Agree to terms and conditions of use. It will take you to the application page.
-
Under Basic Information, note down CHANNEL_SECRET.
-
Under Technical Configuration, set Callback URL e.g. https://26ee637c.ngrok.io/path/to/line/callback
You are ready to use this application as a Login option for your users.
Add following to Gemfile:
gem 'omniauth-line', '~> 0.0.2'
Run bundle install
.
# config/initializers/omniauth.rb
Rails.application.config.middleware.use OmniAuth::Builder do
provider :line, CHANNEL_ID, CHANNEL_SECRET, { callback_path: 'path/to/line/callback' }
end
!/ app/views/path/to/login.html.slim
= link_to 'Login via LINE', '/auth/line'
# app/controllers/sessions_controller.rb
def line_callback
omniauth = request.env['omniauth.auth'] # => #<OmniAuth::AuthHash credentials=#<OmniAuth::AuthHash expires=true expires_at=1500550135 refresh_token="QaH480MmHNhZBNHipabN" token=TOKEN> extra=#<OmniAuth::AuthHash> info=#<OmniAuth::AuthHash::InfoHash description=nil image=IMAGE_URL name="jdbhoewal"> provider="line" uid=UID>
end