vLineRails is a plugin that allows any Rails app to act as a vLine Identity Provider. Every vLine service has at least one registered Identity Provider, which is responsible for authenticating users and providing access to their contact lists and group memberships. The Identity Provider interface is a subset of OAuth 2.0 and OpenSocial 2.5.
Learn more about vLine services at: https://vline.com/developer/
Before installing the plugin, you'll need to:
-
Sign up for a vLine account at https://vline.com.
-
Login to the Developer Console and click
Create Service
. -
Choose a name for your service.
For the vLine servers to be able to make API calls to your provider, your Rails app will need to be running on a publicly accessible server. If your development server is behind a firewall, you can make it publicly accessible with Forward:
gem install forward
forward 3000
If your provider suddenly stops working, check to make sure forward is still running and your server is accessible at the forward URL.
-
Add the plugin to your Gemfile:
gem 'vline-rails'
-
Install it:
bundle install
-
Generate the provider by running the following command:
rails generate vline_provider --service-id=Your-Service-Id --provider-secret=Your-Service-API-Secret
Make note of the
Client Id
andClient Secret
output by the command. -
Review the generated
VlineProviderController
, making any changes necessary to work with your models, authentication framework, and authorization framework.vim app/controllers/vline_controller.rb
-
Open up the vLine Developer Console and choose
Service Settings
. -
Click the
Edit
button and selectCustom OAuth
in theAuthorization
dropdown:- Add the
Client Id
andClient Secret
from therails generate
command you previously ran. - Set the
Provider URL
to :https://your-forward-url/_vline/api/v1/
- Set the
OAuth URL
to:https://your-forward-url/_vline/api/v1/oauth/
- Add the
-
Further customization of the Web Client can be done by providing custom images in the
Web Client Settings
.
You can now launch into your vLine Web Client from any view.
To launch to the Web Client home page:
<%= vline_launch 'Launch' %>
To launch to a particular user's chat page:
<%= vline_launch 'Launch', @userId %>
-
If you are using the Deflater gem to gzip content, make sure it comes before
Rack::JSONP
in theconfig.ru
:require 'rack/jsonp' use Rack::Deflater use Rack::JSONP require ::File.expand_path('../config/environment', __FILE__) run YourApp::Application
-
It's common to need to test changes before rolling them out directly to your users. We suggest creating two vLine services, one of which you can use to test out changes before rolling them out to your users (e.g.,
myservice
andmyservice-dev
).