{"id":166325,"date":"2013-02-27T08:50:05","date_gmt":"2013-02-27T04:50:05","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=166325"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=166325","title":{"rendered":"<span class=\"post_title\">\u0410\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0447\u0435\u0440\u0435\u0437 Facebook, Google, Twitter \u0438 Github \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f Omniauth<\/span>"},"content":{"rendered":"<div class=\"content html_format\">       <i>\u041e\u0437\u0430\u0434\u0430\u0447\u0438\u0432\u0448\u0438\u0441\u044c \u043e\u0434\u043d\u0430\u0436\u0434\u044b \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438\/\u0432\u0445\u043e\u0434\u0430 \u043d\u0430 \u0441\u0430\u0439\u0442 \u0447\u0435\u0440\u0435\u0437 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u043d\u0430\u0447\u0430\u043b \u0438\u0441\u043a\u0430\u0442\u044c, \u0447\u0442\u043e \u0436\u0435 \u0435\u0441\u0442\u044c \u043c\u043e\u0436\u0435\u0442 \u0433\u043e\u0442\u043e\u0432\u043e\u0433\u043e \u043b\u0438\u0431\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043a\u0430\u043a \u044d\u0442\u043e \u0443\u0436 \u043a\u0442\u043e-\u0442\u043e \u0434\u0435\u043b\u0430\u043b. \u0413\u043e\u0442\u043e\u0432\u044b\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0431\u044b\u043b\u0438 \u043e\u0442\u043a\u0438\u043d\u0443 \u0441\u0440\u0430\u0437\u0443, \u043e\u0441\u0442\u0430\u043b\u0441\u044f \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0441\u0430\u043c\u043e\u043c\u0443. \u0418 \u0442\u0443\u0442 Google \u043d\u0430\u0432\u0435\u043b \u043d\u0430 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0443\u044e \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e. \u041e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0432\u0448\u0438\u0441\u044c \u0438 \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u0442\u0435\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u043b \u0441\u0432\u043e\u044e \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e, \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e, \u0431\u044b\u043b \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0447\u0430\u0441\u0442\u043b\u0438\u0432. <\/p>\n<p>  \u0421\u043f\u0443\u0441\u0442\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0447\u0442\u043e-\u0436\u0435 \u0435\u0449\u0435 \u0435\u0441\u0442\u044c \u043d\u0430 \u0442\u043e\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0433\u043e, \u043d\u043e \u0432 \u0441\u0432\u043e\u0435\u043c\u0443 \u0440\u0430\u0437\u043e\u0447\u0430\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u0441\u0430\u0439\u0442 \u0431\u044b\u043b \u043d\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d. \u0421\u043b\u0430\u0432\u0430 \u043a\u044d\u0448\u0443 \u042f\u043d\u0434\u0435\u043a\u0441\u0430, \u043e\u0442\u043a\u0443\u0434\u0430 \u0431\u044b\u043b\u0430 \u0432\u044b\u0434\u0435\u0440\u043d\u0443\u0442\u0430 \u043a\u043e\u043f\u0438\u044f \u0442\u043e\u0433\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430. \u0427\u0442\u043e \u043e\u043d \u043d\u0435 \u043f\u0440\u043e\u043f\u0430\u043b \u0431\u0435\u0437\u0432\u043e\u0437\u0432\u0440\u0430\u0442\u043d\u043e \u0440\u0435\u0448\u0438\u043b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0435\u0433\u043e \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u0438 \u0432\u044b\u043b\u043e\u0436\u0438\u0442\u044c \u0437\u0434\u0435\u0441\u044c.<\/p>\n<p>  \u0418 \u0442\u0430\u043a \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c&#8230;<\/i><\/p>\n<p>  \u042d\u0442\u0430 \u0433\u043b\u0430\u0432\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u0430 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u043c\u0443 \u0433\u0435\u043c\u0443 Omniauth. Omniauth \u044d\u0442\u043e \u043d\u043e\u0432\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u043e\u0432\u0435\u0440\u0445 Rack \u0434\u043b\u044f \u043c\u0443\u043b\u044c\u0442\u0438\u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u043d\u043e\u0439 \u0432\u043d\u0435\u0448\u043d\u0435\u0439 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438. \u041e\u043d \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u0434\u043b\u044f \u0441\u0432\u044f\u0437\u0438 CommunityGuides (\u043f\u0440\u0438\u043c: \u0432 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0440\u0435\u0441\u0443\u0440\u0441 \u043d\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0438 \u043f\u043e\u0445\u043e\u0436\u0435 \u0443\u0436\u0435 \u043d\u0435 \u0432\u0435\u0440\u043d\u0435\u0442\u0441\u044f) \u0441 Facebook, Google, Twitter \u0438 Github. \u0414\u0430\u043d\u043d\u0430\u044f \u0433\u043b\u0430\u0432\u0430 \u043f\u043e\u043a\u0430\u0436\u0435\u0442 \u043a\u0430\u043a \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u044d\u0442\u043e \u0441 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0435\u0439 \u0447\u0435\u0440\u0435\u0437 Devise.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h4>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432\u0445\u043e\u0434 \u0447\u0435\u0440\u0435\u0437 Facebook<\/h4>\n<p>  Omniauth \u2014 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u043e\u0432\u0435\u0440\u0445 Rack \u0434\u043b\u044f \u043c\u0443\u043b\u044c\u0442\u0438\u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u043d\u043e\u0439 \u0432\u043d\u0435\u0448\u043d\u0435\u0439 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438.<br \/>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 Facebook <a href=\"http:\/\/developers.facebook.com\/setup\">developers.facebook.com\/setup<\/a>. \u0423\u043a\u0430\u0436\u0438\u0442\u0435 \u0438\u043c\u044f (\u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c\u0441\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c) \u0438 URL (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <a href=\"http:\/\/www.communityguides.eu\/\">www.communityguides.eu\/<\/a>). Facebook \u0434\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0441\u0430\u0439\u0442, \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u043e\u0439 URL (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <a href=\"http:\/\/localhost:3000\/\">http:\/\/localhost:3000\/<\/a>). \u041d\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0439\u0442\u0435 \u0432 URL localhost \u043b\u0438\u0431\u043e 127.0.0.1 \u044d\u0442\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u0442 \u043a \u043e\u0448\u0438\u0431\u043a\u0435 \u201cinvalid redirect_uri\u201d, \u0447\u0442\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043e. \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0433\u0435\u043c \u2018omniauth\u2019 \u043a \u0432\u0430\u0448\u0435\u043c\u0443 \u043f\u0440\u043e\u0435\u043a\u0442\u0443 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 bundle install, \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0441 \u0432\u0430\u0448\u0438\u043c APP_ID\/APP_SECRET \u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u0441\u0435\u0440\u0432\u0435\u0440.<\/p>\n<p>  <b>Gemfile<\/b>  <\/p>\n<pre><code class=\"ruby\">gem 'omniauth', '0.1.6' <\/code><\/pre>\n<p>  <b>config\/initializers\/omniauth.rb<\/b>  <\/p>\n<pre><code class=\"python\">Rails.application.config.middleware.use OmniAuth::Builder do    provider :facebook, 'APP_ID', 'APP_SECRET'   end <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u043e\u0432\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0438 \u043c\u043e\u0434\u0435\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c\u0438 \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442 \u0441\u0432\u044f\u0437\u044c \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438.<\/p>\n<p>  <b>Terminal<\/b>  <\/p>\n<pre><code class=\"bash\">rails generate model service user_id:integer provider:string uid:string uname:string uemail:string rails generate controller services <\/code><\/pre>\n<p>  <b>app\/models\/user.rb<\/b>  <\/p>\n<pre><code class=\"ruby\">class User &lt; ActiveRecord::Base  devise :database_authenticatable, :oauthable, :registerable,         :recoverable, :rememberable, :trackable, :validatable,         :confirmable, :lockable   has_many :services, :dependent =&gt; :destroy  has_many :articles, :dependent =&gt; :destroy  has_many :comments, :dependent =&gt; :destroy  has_many :ratings, :dependent =&gt; :destroy  belongs_to :country   attr_accessible :email, :password, :password_confirmation, :remember_me, :fullname, :shortbio, :weburl    validates :weburl, :url =&gt; {:allow_blank =&gt; true}, :length =&gt; { :maximum =&gt; 50 }  validates :fullname, :length =&gt; { :maximum =&gt; 40 }  validates :shortbio, :length =&gt; { :maximum =&gt; 500 }   end <\/code><\/pre>\n<p>  <b>app\/models\/service.rb<\/b>  <\/p>\n<pre><code class=\"ruby\">class Service &lt; ActiveRecord::Base  belongs_to :user  attr_accessible :provider, :uid, :uname, :uemail end <\/code><\/pre>\n<p>  <b>config\/routes.rb<\/b>  <\/p>\n<pre><code class=\"ruby\">... match '\/auth\/facebook\/callback' =&gt; 'services#create' resources :services, :only =&gt; [:index, :create] ... <\/code><\/pre>\n<p>  \u041c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438 \u043d\u043e\u0432\u044b\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u044b \u0434\u043b\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 (\u043f\u043e\u043a\u0430 \u0442\u043e\u043b\u044c\u043a\u043e index \u0438 create) \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0439 \u043c\u0430\u0440\u0448\u0440\u0443\u0442 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430. \u0427\u0442\u043e \u044d\u0442\u043e? \u041c\u044b \u0434\u0435\u043b\u0430\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0447\u0435\u0440\u0435\u0437 <a href=\"http:\/\/localhost:3000\/auth\/facebook\">http:\/\/localhost:3000\/auth\/facebook<\/a>. \u0417\u0430\u043f\u0440\u043e\u0441 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430 Facabook \u0438 \u0434\u0430\u043b\u0435\u0435 Facebook \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0432\u0430\u0448\u0443 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043f\u0443\u0442\u044c \/auth\/facebook\/callback. \u041c\u044b \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u0443\u0442\u044c \u043d\u0430\u0448\u0435\u043c\u0443 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0443 Services, \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438 \u043c\u0435\u0442\u043e\u0434\u0443 create. \u0421\u0435\u0439\u0447\u0430\u0441 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043b\u0438\u0448\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0445\u044d\u0448.<\/p>\n<p>  <b>app\/controllers\/services_controller.rb<\/b>  <\/p>\n<pre><code class=\"ruby\">class ServicesController &lt; ApplicationController  def index  end    def create    render :text =&gt; request.env[&quot;omniauth.auth&quot;].to_yaml  end end <\/code><\/pre>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u044d\u0442\u043e. \u041f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 <a href=\"http:\/\/localhost:3000\/auth\/facebook\">http:\/\/localhost:3000\/auth\/facebook<\/a> \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043f\u043e\u043f\u0430\u0434\u0435\u043c \u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0432\u0430\u0448\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u043c \u043d\u0430 Facebook. \u041f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u043c \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u0432 \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 (\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0434\u043b\u044f \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f).<\/p>\n<p>  <b>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b<\/b>  <\/p>\n<pre><code class=\"ruby\">--- user_info:  name: Markus Proske  urls:    Facebook: http:\/\/www.facebook.com\/profile.php?id=....    Website:  nickname: profile.php?id=....  last_name: Proske  first_name: Markus uid: &quot;...&quot; credentials:  token: ........... extra:  user_hash:    name: Markus Proske    timezone: 1    gender: male    id: &quot;....&quot;    last_name: Proske    updated_time: 2010-11-18T13:43:01+0000    verified: true    locale: en_US    link: http:\/\/www.facebook.com\/profile.php?id=........    email: markus.proske@gmail.com    first_name: Markus provider: facebook <\/code><\/pre>\n<p>  \u041d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u044f id, provider name \u0438 email, \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u0432 extra: user_hash. \u0414\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0437\u0430\u043c\u0435\u043d\u0438\u043c create \u043c\u0435\u0442\u043e\u0434 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043a\u043e\u0434\u043e\u043c:<\/p>\n<p>  <b>app\/controllers\/services_controller.rb<\/b>  <\/p>\n<pre><code class=\"ruby\">... def create  omniauth = request.env['omniauth.auth']  if omniauth    omniauth['extra']['user_hash']['email'] ? email =  omniauth['extra']['user_hash']['email'] : email = ''    omniauth['extra']['user_hash']['name'] ? name =  omniauth['extra']['user_hash']['name'] : name = ''    omniauth['extra']['user_hash']['id'] ?  uid =  omniauth['extra']['user_hash']['id'] : uid = ''    omniauth['provider'] ? provider =  omniauth['provider'] : provider = ''        render :text =&gt; uid.to_s + &quot; - &quot; + name + &quot; - &quot; + email + &quot; - &quot; + provider  else    render :text =&gt; 'Error: Omniauth is empty'  end end ... <\/code><\/pre>\n<p>  \u041e\u0442\u043b\u0438\u0447\u043d\u043e, \u043c\u044b \u0441\u0443\u043c\u0435\u043b\u0438 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0447\u0435\u0440\u0435\u0437 Facebook! \u0415\u0449\u0435 \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043c\u043d\u043e\u0433\u043e \u0447\u0435\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u043c\u044b \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u0443\u0435\u043c \u044d\u0442\u043e \u0432 \u043d\u0430\u0448\u0443 \u0441\u0445\u0435\u043c\u0443 \u0441 Devise. \u0415\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u043e\u0432, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0443\u0436\u043d\u043e \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435:  <\/p>\n<ul>\n<li>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u0445\u043e\u0434\u0438\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f Facebook: Facebook \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u043e\u0447\u0442\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0435\u0441\u0442\u044c \u043b\u0438 \u0443\u0436\u0435 \u0442\u0430\u043a\u043e\u0439, \u0435\u0441\u043b\u0438 \u043d\u0435\u0442 \u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043a \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u043c \u0430\u0434\u0440\u0435\u0441\u043e\u043c \u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u043c. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u043c\u043e\u0434\u0435\u043b\u0438 Servi\u0441e \u0434\u043b\u044f Facebook \u0438 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e. <\/li>\n<li>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438\u043b\u0438 \u0432\u0445\u043e\u0434\u0438\u0442 \u0447\u0435\u0440\u0435\u0437 Facebook \u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0430\u0437, \u043d\u043e \u0443\u0436\u0435 \u0438\u043c\u0435\u0435\u0442 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f: \u0441\u043d\u043e\u0432\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0430\u0434\u0440\u0435\u0441 \u043f\u043e\u0447\u0442\u0443\u043e\u0442 Facebook \u0438 \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432 \u043d\u0430\u0448\u0443 \u0431\u0430\u0437\u0443. \u0415\u0441\u043b\u0438 \u043c\u044b \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u0442\u0430\u043a\u043e\u0439 \u0430\u0434\u0440\u0435\u0441, \u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u0442\u044c \u0434\u043b\u044f Facebook \u0438 \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u043c \u0441 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c.<\/li>\n<li>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u0432\u0445\u043e\u0434\u0438\u0442 \u0447\u0435\u0440\u0435\u0437 Facebook: \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432 \u0431\u0430\u0437\u0443 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0432\u0445\u043e\u0434 \u0434\u043b\u044f \u043d\u0435\u0433\u043e.<\/li>\n<\/ul>\n<p>  Omniauth \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u043a\u0430\u043a \u043c\u044b \u0438 \u0441\u0434\u0435\u043b\u0430\u0435\u043c. \u041d\u0430\u0448\u0430 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0437\u0430\u0432\u044f\u0437\u0430\u043d\u0430 \u043d\u0430 \u043f\u043e\u0447\u0442\u043e\u0432\u044b\u0439 \u0430\u0434\u0440\u0435\u0441, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u044b \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0435 \u0435\u0433\u043e \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 Github \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0430\u0434\u0440\u0435\u0441 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435\u043c, \u0435\u0441\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0443\u043a\u0430\u0437\u0430\u043b \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441. Twitter \u043d\u0430\u043f\u0440\u043e\u0442\u0438\u0432 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043f\u043e\u0447\u0442\u043e\u0432\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, Github \u0430\u043a\u043a\u0430\u0443\u043d\u0442 \u0441 \u0430\u0434\u0440\u0435\u0441\u043e\u043c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u043a\u0430\u043a \u0438 Fb \u0434\u043b\u044f \u0432\u0445\u043e\u0434\u0430\/\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438, \u0430 Github \u0431\u0435\u0437 \u0430\u0434\u0440\u0435\u0441\u0430 \u0438\u043b\u0438 Twitter \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u044b \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u043a \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u043c\u0443 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e, \u043b\u0438\u0431\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0447\u0435\u0440\u0435\u0437 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430.<br \/>  \u041a\u0430\u0436\u0434\u044b\u0439 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0445\u044d\u0448 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b. \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u044d\u0442\u043e \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u0434\u0430\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0438\u043c\u0435\u043d\u0430 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u043c\u044b\u043c \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430\u043c. \u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0440\u0430\u0437\u043b\u0438\u0447\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 create. \u0422\u0430\u043a \u0436\u0435 \u0437\u0430\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 (\u0432\u043e\u0439\u0442\u0438 \u0438\u043b\u0438 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c) \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0442 \u043d\u0430\u0441. \u0418\u0437\u043c\u0435\u043d\u0438\u043c \u043d\u0430\u0448 \u043c\u0430\u0440\u0448\u0440\u0443\u0442 \u0441\u043d\u043e\u0432\u0430 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043d\u0435\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043c\u0435\u0449\u0430\u0442\u044c\u0441\u044f \u0438\u043c\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0433\u043e: params[:service].<\/p>\n<p>  <b>config\/routes.rb<\/b>  <\/p>\n<pre><code class=\"ruby\">... match '\/auth\/:service\/callback' =&gt; 'services#create' resources :services, :only =&gt; [:index, :create, :destroy] ... <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0438\u0434\u0435\u043c \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0434\u043b\u044f Github \u0438 Twitter. \u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u0441\u043d\u043e\u0432\u0430 \u043d\u0430 localhost (\u0434\u043b\u044f Twitter-\u0430 \u0432\u043c\u0435\u0441\u0442\u043e localhost \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c 127.0.0.1). \u041f\u043e\u043b\u0443\u0447\u0438\u043c \u043d\u043e\u0432\u044b\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u044b <a href=\"http:\/\/localhost:3000\/auth\/github\/callback\/\">http:\/\/localhost:3000\/auth\/github\/callback\/<\/a> \u0438 <a href=\"http:\/\/127.0.0.1:3000\/auth\/twitter\/callback\">http:\/\/127.0.0.1:3000\/auth\/twitter\/callback<\/a>. \u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u043c \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440.<\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/account\/applications\/new\">github.com\/account\/applications\/new<\/a><\/li>\n<li><a href=\"https:\/\/developer.twitter.com\/apps\/new\">developer.twitter.com\/apps\/new<\/a><\/li>\n<\/ul>\n<p>  <b>config\/initializers\/omniauth.rb<\/b>  <\/p>\n<pre><code class=\"ruby\"># Do not forget to restart your server after changing this file Rails.application.config.middleware.use OmniAuth::Builder do    provider :facebook, 'APP_ID', 'APP_SECRET'  provider :twitter, 'CONSUMER_KEY', 'CONSUMER_SECRET'  provider :github, 'CLIENT ID', 'SECRET' end <\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0438\u0437 \u043f\u0443\u0442\u0438 \u0438 Omniauth \u0445\u044d\u0448\u0430. \u0414\u0430\u043b\u0435\u0435, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0437 \u0445\u0435\u0448\u0430 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u0432 \u043d\u0430\u0448\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435. \u041f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435, \u0441\u0435\u0440\u0432\u0438\u0441 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440 \u0438 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b, \u0438\u043d\u0430\u0447\u0435 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430.<br \/>  <b>\u0427\u0430\u0441\u0442\u044c \u043f\u0435\u0440\u0432\u0430\u044f:<\/b> \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0435\u0449\u0435 \u043d\u0435 \u0432\u043e\u0448\u0435\u043b: \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c, \u0435\u0441\u0442\u044c \u043b\u0438 \u043f\u0430\u0440\u0430 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440-\u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0432 \u043d\u0430\u0448\u0435\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 Service, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442 \u0447\u0442\u043e, \u0434\u0430\u043d\u043d\u0430\u044f \u043f\u0430\u0440\u0430 \u0430\u0441\u0441\u043e\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0430 \u0434\u043b\u044f \u0435\u0433\u043e \u0432\u0445\u043e\u0434\u0430. \u0415\u0441\u043b\u0438 \u044d\u0442\u043e \u0442\u0430\u043a, \u0442\u043e \u0434\u0435\u043b\u0430\u0435\u043c \u0432\u0445\u043e\u0434. \u0415\u0441\u043b\u0438 \u043d\u0435\u0442, \u0442\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u0447\u0442\u043e\u0432\u043e\u0433\u043e \u0430\u0434\u0440\u0435\u0441\u0430. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u044d\u0442\u043e\u0442 \u0430\u0434\u0440\u0435\u0441, \u043c\u044b \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0439\u0442\u0438 \u0432 \u0438\u043c\u0435\u044e\u0449\u0435\u0439\u0441\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0435\u0441\u043b\u0438 \u043e\u043d \u0443\u0436\u0435 \u0431\u044b\u043b \u0441 \u043d\u0438\u043c \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d. \u041a\u043e\u0433\u0434\u0430 \u0442\u0430\u043a\u043e\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0430\u0439\u0434\u0435\u0442\u0441\u044f, \u044d\u0442\u043e\u0442 \u0441\u0435\u0440\u0432\u0438\u0441 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u0435\u043c\u0443 \u0438 \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c \u043e\u043d \u0441\u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0434\u043b\u044f \u0432\u0445\u043e\u0434\u0430. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u043d\u043e\u0432\u044b\u0439 \u043f\u043e\u0447\u0442\u043e\u0432\u044b\u0439 \u0430\u0434\u0440\u0435\u0441, \u0442\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u043c \u0435\u0433\u043e \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0435\u043c\u0443.<br \/>  <b>\u0427\u0430\u0441\u0442\u044c \u0432\u0442\u043e\u0440\u0430\u044f<\/b>: \u0435\u0441\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0443\u0436\u0435 \u0432\u043e\u0448\u0435\u043b: \u041c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u043a \u0435\u0433\u043e \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0443 \u0435\u0441\u043b\u0438 \u043d\u0435 \u0431\u044b\u043b \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u0440\u0430\u043d\u0435\u0435.<br \/>  \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0438\u0436\u0435 \u043d\u0430 \u043c\u0435\u0442\u043e\u0434 Create. \u041e\u043d \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432\u0435\u0441\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u043a\u043e\u0434 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u0432\u044b\u0448\u0435 \u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u0434\u043b\u044f Facebook, Github \u0438 Twitter. \u0417\u0430\u043c\u0435\u0442\u044c\u0442\u0435, \u0447\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e 4 \u0441\u0442\u0440\u043e\u043a\u0438 \u043a\u043e\u0434\u0430 \u043d\u0443\u0436\u043d\u044b \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430. \u0415\u0449\u0435 \u043d\u0435\u0442\u0443 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e, \u043d\u043e \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u0439\u0434\u044f \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0430\u043c \u0441\u0430\u043c\u0438:  <\/p>\n<ul>\n<li>Facebook: <a href=\"http:\/\/localhost:3000\/auth\/facebook\">http:\/\/localhost:3000\/auth\/facebook<\/a><\/li>\n<li>Github: <a href=\"http:\/\/localhost:3000\/auth\/github\">http:\/\/localhost:3000\/auth\/github<\/a><\/li>\n<li>Twitter: <a href=\"http:\/\/localhost:3000\/auth\/twitter\">http:\/\/localhost:3000\/auth\/twitter<\/a><\/li>\n<li>Index \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u0432\u0441\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u043a \u0442\u0435\u043a\u0443\u0449\u0435\u043c\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e: <a href=\"http:\/\/localhost:3000\/services\">http:\/\/localhost:3000\/services<\/a> (\u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u044d\u0442\u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043f\u043e\u0437\u0436\u0435 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441\u043e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430\u043c\u0438 \u0432\u0445\u043e\u0434\u0430 \u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438)<\/li>\n<li>\u043c\u0435\u0442\u043e\u0434 Delete \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u0441\u0435\u0440\u0432\u0438\u0441.<\/li>\n<\/ul>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">app\/controllers\/services_controller.rb<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"ruby\">class ServicesController &lt; ApplicationController  before_filter :authenticate_user!, :except =&gt; [:create]  def index  # get all authentication services assigned to the current user  @services = current_user.services.all end  def destroy  # remove an authentication service linked to the current user  @service = current_user.services.find(params[:id])  @service.destroy    redirect_to services_path end  def create  # get the service parameter from the Rails router  params[:service] ? service_route = params[:service] : service_route = 'no service (invalid callback)'   # get the full hash from omniauth  omniauth = request.env['omniauth.auth']   # continue only if hash and parameter exist  if omniauth and params[:service]        # map the returned hashes to our variables first - the hashes differ for every service    if service_route == 'facebook'      omniauth['extra']['user_hash']['email'] ? email =  omniauth['extra']['user_hash']['email'] : email = ''      omniauth['extra']['user_hash']['name'] ? name =  omniauth['extra']['user_hash']['name'] : name = ''      omniauth['extra']['user_hash']['id'] ?  uid =  omniauth['extra']['user_hash']['id'] : uid = ''      omniauth['provider'] ? provider =  omniauth['provider'] : provider = ''    elsif service_route == 'github'      omniauth['user_info']['email'] ? email =  omniauth['user_info']['email'] : email = ''      omniauth['user_info']['name'] ? name =  omniauth['user_info']['name'] : name = ''      omniauth['extra']['user_hash']['id'] ?  uid =  omniauth['extra']['user_hash']['id'] : uid = ''      omniauth['provider'] ? provider =  omniauth['provider'] : provider = ''    elsif service_route == 'twitter'      email = ''    # Twitter API never returns the email address      omniauth['user_info']['name'] ? name =  omniauth['user_info']['name'] : name = ''      omniauth['uid'] ?  uid =  omniauth['uid'] : uid = ''      omniauth['provider'] ? provider =  omniauth['provider'] : provider = ''    else      # we have an unrecognized service, just output the hash that has been returned      render :text =&gt; omniauth.to_yaml      #render :text =&gt; uid.to_s + &quot; - &quot; + name + &quot; - &quot; + email + &quot; - &quot; + provider      return    end      # continue only if provider and uid exist    if uid != '' and provider != ''              # nobody can sign in twice, nobody can sign up while being signed in (this saves a lot of trouble)      if !user_signed_in?                # check if user has already signed in using this service provider and continue with sign in process if yes        auth = Service.find_by_provider_and_uid(provider, uid)        if auth          flash[:notice] = 'Signed in successfully via ' + provider.capitalize + '.'          sign_in_and_redirect(:user, auth.user)        else          # check if this user is already registered with this email address; get out if no email has been provided          if email != ''            # search for a user with this email address            existinguser = User.find_by_email(email)            if existinguser              # map this new login method via a service provider to an existing account if the email address is the same              existinguser.services.create(:provider =&gt; provider, :uid =&gt; uid, :uname =&gt; name, :uemail =&gt; email)              flash[:notice] = 'Sign in via ' + provider.capitalize + ' has been added to your account ' + existinguser.email + '. Signed in successfully!'              sign_in_and_redirect(:user, existinguser)            else              # let's create a new user: register this user and add this authentication method for this user              name = name[0, 39] if name.length &gt; 39             # otherwise our user validation will hit us               # new user, set email, a random password and take the name from the authentication service              user = User.new :email =&gt; email, :password =&gt; SecureRandom.hex(10), :fullname =&gt; name               # add this authentication service to our new user              user.services.build(:provider =&gt; provider, :uid =&gt; uid, :uname =&gt; name, :uemail =&gt; email)               # do not send confirmation email, we directly save and confirm the new record              user.skip_confirmation!              user.save!              user.confirm!               # flash and sign in              flash[:myinfo] = 'Your account on CommunityGuides has been created via ' + provider.capitalize + '. In your profile you can change your personal information and add a local password.'              sign_in_and_redirect(:user, user)            end          else            flash[:error] =  service_route.capitalize + ' can not be used to sign-up on CommunityGuides as no valid email address has been provided. Please use another authentication provider or use local sign-up. If you already have an account, please sign-in and add ' + service_route.capitalize + ' from your profile.'            redirect_to new_user_session_path          end        end      else        # the user is currently signed in                # check if this service is already linked to his\/her account, if not, add it        auth = Service.find_by_provider_and_uid(provider, uid)        if !auth          current_user.services.create(:provider =&gt; provider, :uid =&gt; uid, :uname =&gt; name, :uemail =&gt; email)          flash[:notice] = 'Sign in via ' + provider.capitalize + ' has been added to your account.'          redirect_to services_path        else          flash[:notice] = service_route.capitalize + ' is already linked to your account.'          redirect_to services_path        end        end      else      flash[:error] =  service_route.capitalize + ' returned invalid data for the user id.'      redirect_to new_user_session_path    end  else    flash[:error] = 'Error while authenticating via ' + service_route.capitalize + '.'    redirect_to new_user_session_path  end end <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041d\u0430\u0448 \u043a\u043e\u0434 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u0435\u043d \u0438 \u043f\u0440\u044f\u043c\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0434\u0438\u043d \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0430\u043a\u043a\u0430\u0443\u043d\u0442 \u0438 \u0442\u0440\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0434\u043b\u044f \u0432\u0445\u043e\u0434\u0430 \u0438\u043b\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438. \u041d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0442\u043e \u0447\u0442\u043e, \u0432\u0445\u043e\u0434 \u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u0440\u043e\u0445\u043e\u0434\u044f\u0442 \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u043f\u0443\u0442\u0438 \/auth\/service \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u0432\u0441\u0435\u0433\u0434\u0430 \u0438\u0434\u0435\u0442 \u043d\u0430 \/auth\/service\/callback.<br \/>  \u041d\u0430\u0448 \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043d\u043e \u0435\u0441\u0442\u044c \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u043d\u0435\u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0430\u043c: \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0441 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u043c \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u043e\u0432 (\u043f\u043e\u0447\u0442\u0430: one@user.com) \u0438 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0430 \u0432 Facebook (\u043f\u043e\u0447\u0442\u0430: two@user.com) \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u0436\u0435 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d \u043a \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u043c\u0443. \u041d\u0438\u043a\u0430\u043a\u0438\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c, \u0430\u0434\u0440\u0435\u0441\u0430 \u043d\u0435 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u044e\u0442. \u0415\u0441\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0438\u043c\u0435\u0435\u0442 Google \u0430\u043a\u043a\u0430\u0443\u043d\u0442 \u0441 \u043f\u043e\u0447\u0442\u043e\u0439: three@user.com, \u0442\u043e \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d \u0431\u0435\u0437 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u043f\u043e\u043a\u0430 \u0441\u0435\u0441\u0441\u0438\u044f \u0430\u043a\u0442\u0438\u0432\u043d\u0430. \u0421 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u043b Google \u0430\u043a\u043a\u0430\u0443\u043d\u0442 \u0438 \u043e\u043d \u0435\u0449\u0435 \u043d\u0435 \u0432\u043e\u0448\u0435\u043b: \u0435\u0441\u043b\u0438 \u043e\u043d \u043d\u0430\u0436\u043c\u0435\u0442 \u043d\u0430 \u201c\u0432\u043e\u0439\u0442\u0438 \u0447\u0435\u0440\u0435\u0437 Google\u201d \u043d\u0430\u0448 create \u043c\u0435\u0442\u043e\u0434 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442 \u043f\u043e\u0438\u0441\u043a \u0434\u043b\u044f three@user.com, \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u0442 \u0438 \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<br \/>  \u041f\u0440\u0438\u0448\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0430\u0440\u0443 \u0432\u044c\u044e\u0448\u0435\u043a, \u043d\u0430\u0447\u043d\u0435\u043c \u0441 \u0432\u0445\u043e\u0434\u0430 \u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">app\/views\/devise\/sessions\/new.html.erb<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"html\">&lt;section id=&quot;deviseauth&quot;&gt;    &lt;h2&gt;Sign in&lt;\/h2&gt;     &lt;h3&gt;Sign in with your CommunityGuides account -- OR -- use an authentication service&lt;\/h3&gt;     &lt;div id=&quot;local&quot; class=&quot;box&quot;&gt;            &lt;%= form_for(resource, :as =&gt; resource_name, :url =&gt; session_path(resource_name)) do |f| %&gt;          &lt;p&gt;&lt;%= f.label :email %&gt;&lt;br \/&gt;          &lt;%= f.text_field :email %&gt;&lt;\/p&gt;           &lt;p&gt;&lt;%= f.label :password %&gt;&lt;br \/&gt;          &lt;%= f.password_field :password %&gt;&lt;\/p&gt;           &lt;% if devise_mapping.rememberable? %&gt;            &lt;p&gt;&lt;%= f.check_box :remember_me %&gt; &lt;%= f.label :remember_me %&gt;&lt;\/p&gt;          &lt;% end %&gt;           &lt;p&gt;&lt;%= f.submit &quot;Sign in&quot; %&gt;&lt;\/p&gt;        &lt;% end %&gt;    &lt;\/div&gt;     &lt;div id=&quot;remote&quot;&gt;        &lt;div id=&quot;terms&quot; class=&quot;box&quot;&gt;            &lt;%= link_to &quot;Terms of Service&quot;, &quot;#&quot; %&gt;        &lt;\/div&gt;          &lt;div id=&quot;services&quot; class=&quot;box&quot;&gt;            &lt;a href=&quot;\/auth\/facebook&quot; class=&quot;services&quot;&gt;&lt;%= image_tag &quot;facebook_64.png&quot;, :size =&gt; &quot;64x64&quot;,  :alt =&gt; &quot;Facebook&quot; %&gt;Facebook&lt;\/a&gt;            &lt;a href=&quot;\/auth\/google&quot; class=&quot;services&quot;&gt;&lt;%= image_tag &quot;google_64.png&quot;, :size =&gt; &quot;64x64&quot;,  :alt =&gt; &quot;Google&quot; %&gt;Google&lt;\/a&gt;            &lt;a href=&quot;\/auth\/github&quot; class=&quot;services&quot;&gt;&lt;%= image_tag &quot;github_64.png&quot;, :size =&gt; &quot;64x64&quot;,  :alt =&gt; &quot;Github&quot; %&gt;Github&lt;\/a&gt;            &lt;a href=&quot;\/auth\/twitter&quot; class=&quot;services&quot;&gt;&lt;%= image_tag &quot;twitter_64.png&quot;, :size =&gt; &quot;64x64&quot;,  :alt =&gt; &quot;Twitter&quot; %&gt;Twitter&lt;\/a&gt;        &lt;\/div&gt;    &lt;\/div&gt;     &lt;div id=&quot;devise_links&quot;&gt;        &lt;%= render :partial =&gt; &quot;devise\/shared\/links&quot; %&gt;    &lt;\/div&gt; &lt;\/section&gt; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<div class=\"spoiler\"><b class=\"spoiler_title\">app\/views\/users\/registrations\/new.html.erb<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"html\">&lt;section id=&quot;deviseauth&quot;&gt;    &lt;h2&gt;Sign up&lt;\/h2&gt;     &lt;h3&gt;Sign up on CommunityGuides manually -- OR -- or use one of your existing accounts&lt;\/h3&gt;     &lt;div id=&quot;local2&quot; class=&quot;box&quot;&gt;        &lt;%= form_for(resource, :as =&gt; resource_name, :url =&gt; registration_path(resource_name)) do |f| %&gt;          &lt;%= devise_error_messages! %&gt;           &lt;p&gt;&lt;%= f.label :email %&gt;&lt;br \/&gt;          &lt;%= f.text_field :email %&gt;&lt;\/p&gt;           &lt;p&gt;&lt;%= f.label :password %&gt;&lt;br \/&gt;          &lt;%= f.password_field :password %&gt;&lt;\/p&gt;           &lt;p&gt;&lt;%= f.label :password_confirmation %&gt;&lt;br \/&gt;          &lt;%= f.password_field :password_confirmation %&gt;&lt;\/p&gt;           &lt;p&gt;&lt;%= recaptcha_tags %&gt;&lt;\/p&gt;           &lt;p&gt;&lt;%= f.submit &quot;Sign up&quot; %&gt;&lt;\/p&gt;        &lt;% end %&gt;    &lt;\/div&gt;     &lt;div id=&quot;remote2&quot;&gt;        &lt;div id=&quot;terms&quot; class=&quot;box&quot;&gt;            &lt;%= link_to &quot;Terms of Service&quot;, &quot;#&quot; %&gt;        &lt;\/div&gt;          &lt;div id=&quot;services&quot; class=&quot;box&quot;&gt;            &lt;a href=&quot;\/auth\/facebook&quot; class=&quot;services2&quot;&gt;&lt;%= image_tag &quot;facebook_64.png&quot;, :size =&gt; &quot;64x64&quot;,  :alt =&gt; &quot;Facebook&quot; %&gt;Facebook&lt;\/a&gt;            &lt;a href=&quot;\/auth\/google&quot; class=&quot;services2&quot;&gt;&lt;%= image_tag &quot;google_64.png&quot;, :size =&gt; &quot;64x64&quot;,  :alt =&gt; &quot;Google&quot; %&gt;Google&lt;\/a&gt;            &lt;a href=&quot;\/auth\/github&quot; class=&quot;services2&quot;&gt;&lt;%= image_tag &quot;github_64.png&quot;, :size =&gt; &quot;64x64&quot;,  :alt =&gt; &quot;Github&quot; %&gt;Github*&lt;\/a&gt;            &lt;div id=&quot;footnote_signup&quot;&gt;* You can use Github only if you set a public email address&lt;\/div&gt;        &lt;\/div&gt;      &lt;\/div&gt;     &lt;div id=&quot;devise_links&quot;&gt;        &lt;%= render :partial =&gt; &quot;devise\/shared\/links&quot; %&gt;    &lt;\/div&gt; &lt;\/section&gt; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f <a href=\"https:\/\/github.com\/intridea\/authbuttons\">Github:Authbuttons<\/a>. \u0421\u0435\u0439\u0447\u0430\u0441 \u043d\u0430\u0448\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u0432\u0445\u043e\u0434\u0438\u0442\u044c \u0438\u043b\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441. \u0412 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0441 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438, \u0433\u0434\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u0441\u043c\u043e\u0433\u0443\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0430\u043c\u0438 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u043c\u0438 \u0441 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u043c.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">app\/views\/services\/index.html.erb<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"html\">&lt;section id=&quot;deviseauth&quot;&gt;    &lt;h2&gt;Authentication Services - Setting&lt;\/h2&gt;     &lt;div id=&quot;currservices&quot;&gt;        &lt;h3&gt;The following &lt;%= @services.count == 1 ? 'account is' : 'accounts are' %&gt; connected with your local account at CommunityGuides:&lt;\/h3&gt;            &lt;% @services.each do |service| %&gt;            &lt;div class=&quot;services_used&quot;&gt;                &lt;%= image_tag &quot;#{service.provider}_64.png&quot;, :size =&gt; &quot;64x64&quot; %&gt;              &lt;div class = &quot;user&quot;&gt;                &lt;div class=&quot;line1&quot;&gt;Name: &lt;%= service.uname %&gt; (ID: &lt;%= service.uid %&gt;)&lt;\/div&gt;                  &lt;div class=&quot;line2&quot;&gt;Email: &lt;%= service.uemail != '' ? service.uemail : 'not set' %&gt;&lt;\/div&gt;                &lt;div class=&quot;line3&quot;&gt;                    &lt;% @services.count == 1 ? @msg = 'Removing the last account linked might lock you out of your account if you do not know the email\/password sign-in of your local account!' : @msg = '' %&gt;                    &lt;%= link_to &quot;Remove this service&quot;, service, :confirm =&gt; 'Are you sure you want to remove this authentication service? ' + @msg, :method =&gt; :delete, :class =&gt; &quot;remove&quot; %&gt;                &lt;\/div&gt;              &lt;\/div&gt;          &lt;\/div&gt;          &lt;% end %&gt;    &lt;\/div&gt;     &lt;div id=&quot;availableservices&quot;&gt;        &lt;h3&gt;You can connect more services to your account:&lt;\/h3&gt;        &lt;div id=&quot;services&quot;&gt;            &lt;a href=&quot;\/auth\/facebook&quot; class=&quot;services&quot;&gt;&lt;%= image_tag &quot;facebook_64.png&quot;, :size =&gt; &quot;64x64&quot;,  :alt =&gt; &quot;Facebook&quot; %&gt;Facebook&lt;\/a&gt;            &lt;a href=&quot;\/auth\/google&quot; class=&quot;services&quot;&gt;&lt;%= image_tag &quot;google_64.png&quot;, :size =&gt; &quot;64x64&quot;,  :alt =&gt; &quot;Google&quot; %&gt;Google&lt;\/a&gt;            &lt;a href=&quot;\/auth\/github&quot; class=&quot;services&quot;&gt;&lt;%= image_tag &quot;github_64.png&quot;, :size =&gt; &quot;64x64&quot;,  :alt =&gt; &quot;Github&quot; %&gt;Github&lt;\/a&gt;            &lt;a href=&quot;\/auth\/twitter&quot; class=&quot;services&quot;&gt;&lt;%= image_tag &quot;twitter_64.png&quot;, :size =&gt; &quot;64x64&quot;,  :alt =&gt; &quot;Twitter&quot; %&gt;Twitter&lt;\/a&gt;        &lt;\/div&gt;        &lt;h4&gt;If you signed-up for CommunityGuides via an authentication service a random password has been set for the local password. You can request a new password using the &quot;Forgot your Password?&quot; link on the sign-in page.&lt;\/h4&gt;    &lt;\/div&gt;   &lt;\/section&gt; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<h5>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c Google<\/h5>\n<p>  \u041d\u0430\u043a\u043e\u043d\u0435\u0446 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c Google \u043a \u0441\u043f\u0438\u0441\u043a\u0443 \u043d\u0430\u0448\u0438\u0445 \u0441\u0435\u0440\u0432\u0438\u0441 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u043e\u0432. Google (\u0438 OpenID \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438) \u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e\u0433\u043e \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c ActiveRecord \u0438\u043b\u0438 \u0444\u0430\u0439\u043b\u043e\u0432\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0438\u0436\u0435. \u0415\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044c \u043d\u0430 Heroku, \u043f\u043e\u043c\u043d\u0438\u0442\u0435, \u0447\u0442\u043e \u0443 \u0432\u0430\u0441 \u043d\u0435\u0442\u0443 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043d\u0430 \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \/tmp. \u0425\u043e\u0442\u044f, \u043a\u0430\u043a \u043e\u0442\u043c\u0435\u0447\u0435\u043d\u043e \u0432 <a href=\"https:\/\/devcenter.heroku.com\/articles\/read-only-filesystem\">Heroku Docs<\/a>, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0438\u0441\u0430\u0442\u044c \u0432 .\/tmp.<\/p>\n<p>  \u0414\u0432\u0435 \u0441\u0442\u0440\u043e\u0447\u043a\u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0439 \u0438 \u0447\u0435\u0442\u044b\u0440\u0435 \u0434\u043b\u044f \u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0438\u0437 \u0445\u0435\u0448\u0430 \u2014 \u044d\u0442\u043e \u0432\u0441\u0435 \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0447\u0435\u0440\u0435\u0437 Google \u0432 \u0432\u0430\u0448\u0435\u043c \u043a\u043e\u0434\u0435. \u042d\u0442\u043e \u043b\u0438 \u043d\u0435 \u0432\u0435\u043b\u0438\u043a\u043e\u043b\u0435\u043f\u043d\u043e? \u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e Omniauth \u043d\u0430 \u0441\u0435\u0433\u043e\u0434\u043d\u044f, \u043d\u043e \u0435\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0432 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u0432\u0430\u0448\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u043c\u043d\u043e\u0433\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0432 <a href=\"https:\/\/github.com\/intridea\/omniauth\/wik\">Omniauth Wiki<\/a>, \u0442\u0430\u043a\u0436\u0435 \u0420\u0430\u0439\u043d\u0430 \u0411\u044d\u0439\u0442\u0441 \u0441\u0434\u0435\u043b\u0430\u043b \u0432\u0435\u043b\u0438\u043a\u043e\u043b\u0435\u043f\u043d\u044b\u0435 <a href=\"http:\/\/railscasts.com\/episodes?utf8=%E2%9C%93&amp;search=omniauth\">\u0441\u043a\u0440\u0438\u043d\u043a\u0430\u0441\u0442\u044b<\/a> \u043f\u043e \u043d\u0435\u043c\u0443.<\/p>\n<h5>\u0412\u043d\u043e\u0432\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c Devise<\/h5>\n<p>  \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u043a \u0432 \u043f\u0440\u043e\u0444\u0438\u043b\u0435 \u043d\u0430\u0448\u0438\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439. \u041f\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043d\u0443\u0436\u043d\u043e \u0432\u0432\u043e\u0434\u0438\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043f\u0430\u0440\u043e\u043b\u044c \u0434\u043b\u044f \u0441\u043c\u0435\u043d\u044b \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a. \u0415\u0441\u043b\u0438 \u043e\u043d \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d \u0447\u0435\u0440\u0435\u0437 \u043e\u0434\u0438\u043d \u0438\u0437 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u0442\u043e \u043e\u043d \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u043f\u0430\u0440\u043e\u043b\u044f, \u043f\u043e\u043c\u043d\u0438\u0442\u0435, \u043c\u044b \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u043b\u0438 \u0435\u0433\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443. \u0412 Devise Wiki \u0435\u0441\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u044f \u0441 \u0442\u0435\u043c \u043a\u0430\u043a \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0443\u0431\u0440\u0430\u0442\u044c \u043f\u0430\u0440\u043e\u043b\u044c. \u041d\u043e \u0443 \u0441\u0435\u0431\u044f \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u0430\u0440\u043e\u043b\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439. \u0414\u043b\u044f \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u043c \u043c\u0435\u043d\u044f\u0442\u044c \u0441\u0432\u043e\u0439 \u043f\u0440\u043e\u0444\u0438\u0442\u044c \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0430\u0440\u043e\u043b\u044f. \u0412 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435, \u043e\u043d\u0438 \u0441\u043c\u043e\u0433\u0443\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0430\u0440\u043e\u043b\u044c \u0435\u0441\u043b\u0438 \u0437\u0430\u0445\u043e\u0442\u044f\u0442. \u042d\u0442\u043e \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u0435\u0442\u0441\u044f \u043f\u0443\u0442\u0435\u043c \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043c\u0435\u0442\u043e\u0434\u0430 update \u0434\u043b\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">app\/controllers\/users\/registrations_controller.rb<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"ruby\">... def update  # no mass assignment for country_id, we do it manually  # check for existence of the country in case a malicious user manipulates the params (fails silently)  if params[resource_name][:country_id]              resource.country_id = params[resource_name][:country_id] if Country.find_by_id(params[resource_name][:country_id])  end   if current_user.haslocalpw    super  else    # this account has been created with a random pw \/ the user is signed in via an omniauth service    # if the user does not want to set a password we remove the params to prevent a validation error    if params[resource_name][:password].blank?      params[resource_name].delete(:password)      params[resource_name].delete(:password_confirmation) if params[resource_name][:password_confirmation].blank?    else      # if the user wants to set a password we set haslocalpw for the future      params[resource_name][:haslocalpw] = true    end        # this is copied over from the original devise controller, instead of update_with_password we use update_attributes    if resource.update_attributes(params[resource_name])       set_flash_message :notice, :updated       sign_in resource_name, resource       redirect_to after_update_path_for(resource)     else       clean_up_passwords(resource)       render_with_scope :edit     end  end end ... <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041a\u043e\u0434 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u043b\u0435 \u0432 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044e (<i>t.boolean :haslocalpw, :null =&gt; false, :default =&gt; true<\/i>), \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u0435 \u043c\u043e\u0434\u0435\u043b\u044c \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043c\u0430\u0441\u0441\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u044f \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u043b\u044f, \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u0435 \u0432\u044c\u044e\u0448\u043a\u0443 \u0447\u0442\u043e\u0431\u044b \u0441\u043a\u0440\u044b\u0442\u044c \u043f\u043e\u043b\u0435 \u0434\u043b\u044f \u0432\u0432\u043e\u0434\u0430 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043f\u0430\u0440\u043e\u043b\u044f \u0435\u0441\u043b\u0438 haslocalpw \u043b\u043e\u0436\u043d\u043e \u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u043c create \u043c\u0435\u0442\u043e\u0434 \u043d\u0430\u0448\u0435\u0433\u043e service \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u0434\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u043b\u044f \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f:<\/p>\n<p>  <b>app\/controllers\/services_controller.rb<\/b>  <\/p>\n<pre><code class=\"ruby\">...  user = User.new :email =&gt; email, :password =&gt; SecureRandom.hex(10), :fullname =&gt; name, :haslocalpw =&gt; false ... <\/code><\/pre>\n<p>  PS: \u044d\u0442\u043e \u043f\u0435\u0440\u0432\u044b\u0439 \u043c\u043e\u0439 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u0435\u0440\u0435\u0432\u043e\u0434, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u0441\u044c\u0431\u0430 \u043e\u0448\u0438\u0431\u043a\u0438\/\u043a\u0440\u0438\u0432\u044b\u0435 \u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u043a\u0438 \u0432 \u043b\u0438\u0447\u043a\u0443. \u0411\u043e\u043b\u044c\u0448\u043e\u0435 \u0441\u043f\u0430\u0441\u0438\u0431\u043e.        \t\t   \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/166325\/\"> http:\/\/habrahabr.ru\/post\/166325\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">       <i>\u041e\u0437\u0430\u0434\u0430\u0447\u0438\u0432\u0448\u0438\u0441\u044c \u043e\u0434\u043d\u0430\u0436\u0434\u044b \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438\/\u0432\u0445\u043e\u0434\u0430 \u043d\u0430 \u0441\u0430\u0439\u0442 \u0447\u0435\u0440\u0435\u0437 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u043d\u0430\u0447\u0430\u043b \u0438\u0441\u043a\u0430\u0442\u044c, \u0447\u0442\u043e \u0436\u0435 \u0435\u0441\u0442\u044c \u043c\u043e\u0436\u0435\u0442 \u0433\u043e\u0442\u043e\u0432\u043e\u0433\u043e \u043b\u0438\u0431\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043a\u0430\u043a \u044d\u0442\u043e \u0443\u0436 \u043a\u0442\u043e-\u0442\u043e \u0434\u0435\u043b\u0430\u043b. \u0413\u043e\u0442\u043e\u0432\u044b\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0431\u044b\u043b\u0438 \u043e\u0442\u043a\u0438\u043d\u0443 \u0441\u0440\u0430\u0437\u0443, \u043e\u0441\u0442\u0430\u043b\u0441\u044f \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0441\u0430\u043c\u043e\u043c\u0443. \u0418 \u0442\u0443\u0442 Google \u043d\u0430\u0432\u0435\u043b \u043d\u0430 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0443\u044e \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e. \u041e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0432\u0448\u0438\u0441\u044c \u0438 \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u0442\u0435\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u043b \u0441\u0432\u043e\u044e \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e, \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e, \u0431\u044b\u043b \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0447\u0430\u0441\u0442\u043b\u0438\u0432. <\/p>\n<p>  \u0421\u043f\u0443\u0441\u0442\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0447\u0442\u043e-\u0436\u0435 \u0435\u0449\u0435 \u0435\u0441\u0442\u044c \u043d\u0430 \u0442\u043e\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0433\u043e, \u043d\u043e \u0432 \u0441\u0432\u043e\u0435\u043c\u0443 \u0440\u0430\u0437\u043e\u0447\u0430\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u0441\u0430\u0439\u0442 \u0431\u044b\u043b \u043d\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d. \u0421\u043b\u0430\u0432\u0430 \u043a\u044d\u0448\u0443 \u042f\u043d\u0434\u0435\u043a\u0441\u0430, \u043e\u0442\u043a\u0443\u0434\u0430 \u0431\u044b\u043b\u0430 \u0432\u044b\u0434\u0435\u0440\u043d\u0443\u0442\u0430 \u043a\u043e\u043f\u0438\u044f \u0442\u043e\u0433\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430. \u0427\u0442\u043e \u043e\u043d \u043d\u0435 \u043f\u0440\u043e\u043f\u0430\u043b \u0431\u0435\u0437\u0432\u043e\u0437\u0432\u0440\u0430\u0442\u043d\u043e \u0440\u0435\u0448\u0438\u043b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0435\u0433\u043e \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u0438 \u0432\u044b\u043b\u043e\u0436\u0438\u0442\u044c \u0437\u0434\u0435\u0441\u044c.<\/p>\n<p>  \u0418 \u0442\u0430\u043a \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c&#8230;<\/i><\/p>\n<p>  \u042d\u0442\u0430 \u0433\u043b\u0430\u0432\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u0430 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u043c\u0443 \u0433\u0435\u043c\u0443 Omniauth. Omniauth \u044d\u0442\u043e \u043d\u043e\u0432\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u043e\u0432\u0435\u0440\u0445 Rack \u0434\u043b\u044f \u043c\u0443\u043b\u044c\u0442\u0438\u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u043d\u043e\u0439 \u0432\u043d\u0435\u0448\u043d\u0435\u0439 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438. \u041e\u043d \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u0434\u043b\u044f \u0441\u0432\u044f\u0437\u0438 CommunityGuides (\u043f\u0440\u0438\u043c: \u0432 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0440\u0435\u0441\u0443\u0440\u0441 \u043d\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0438 \u043f\u043e\u0445\u043e\u0436\u0435 \u0443\u0436\u0435 \u043d\u0435 \u0432\u0435\u0440\u043d\u0435\u0442\u0441\u044f) \u0441 Facebook, Google, Twitter \u0438 Github. \u0414\u0430\u043d\u043d\u0430\u044f \u0433\u043b\u0430\u0432\u0430 \u043f\u043e\u043a\u0430\u0436\u0435\u0442 \u043a\u0430\u043a \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u044d\u0442\u043e \u0441 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0435\u0439 \u0447\u0435\u0440\u0435\u0437 Devise.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-166325","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/166325","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=166325"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/166325\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=166325"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=166325"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=166325"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}