Sha256: 8810e9d83e485185862634ce95b05e8490a3bc8dc432a9f7ef0c44636ac8d19b

Contents?: true

Size: 572 Bytes

Versions: 2

Compression:

Stored size: 572 Bytes

Contents

class RailsAuthApi::OauthUsersController < RailsAuthApi::BaseController

  def create
    @oauth_user = OauthUser.find_or_initialize_by(type: oauth_user_params[:type], uid: oauth_user_params[:uid])
    @oauth_user.save_info(oauth_user_params)
    @oauth_user.init_user

    if @oauth_user.save
      login_as @oauth_user.user
      render json: { oauth_user: @oauth_user.as_json, user: @oauth_user.user.as_json }
    end
  end

  private
  def oauth_user_params
    params.fetch(:oauth_user, {}).permit(:uid, :provider, :type, :name, :access_token, :auth_code)
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rails_auth-1.0.5 app/controllers/rails_auth_api/oauth_users_controller.rb
rails_auth-1.0.4 app/controllers/rails_auth_api/oauth_users_controller.rb