samedi 6 mai 2017

How to create and implement token based authentication api in rails for androidapp

i want to make a rails api for android app,but iam confused with the authentication,because of use of devise in my rails web apps iam totally blanked here.i have designed my file system such a way like(path controller/api/v1/api_controller)in which i have made a single controller for api like

    module Api::V1

    class ApiController < ApplicationController
    protect_from_forgery with: :null_session


      def apimodel
        return Api::Modelv1.new
      end 

same i have done in models(paths model/api/modelv1.rb)

now iam totally blank how to setup a authentication,wheather to use devise for user model or create our custom user model then how and what to add to generate authenticity tokens instead of sessions,and what are headerz and oll iam realy confused.the main thing is by googling iam not able to find out were to add what.please help me out as am new to rails(also i want is how to carry signup and check logins with that tokens)..and it will be appriciated if someone explain thw whole process with code.thank you

Aucun commentaire:

Enregistrer un commentaire