weteamsteve / squadsnap2

The #2 sports team management app that makes communication and organization a breeze. Clubs and leagues love us too. Try it now.
1 stars 0 forks source link

Get user authentication working backend to frontend #1

Open weteamsteve opened 5 years ago

weteamsteve commented 5 years ago

Get user authentication working backend to frontend, allow user to execute join / promote / demote actions on squads appropriately.

Investigate react-devise (github).

Much of Devise's functionality involves server side routing and rendering, so what about single page apps? Does Devise do that, or must you leave Devise behind when you move to React? Maybe not. It turns out it's pretty easy to purpose Devise as an authentication backend.

Probably some way of using JWT (JSON Web Token) for Devise authentication, and then having the routes and stores available on the frontend. Check out react-devise usage for more information.

weteamsteve commented 5 years ago

Check out Devise with React Webpacker and Rails (incomplete guide) Check out React Rails Devise Sessions Basic

weteamsteve commented 5 years ago
class UsersController < ActionController::Base
  def check_for_user
    if user_signed_in?
      render :json => current_user.to_json
    else
      render :json => User.new.to_json
    end
  end
end