This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
class ApplicationController < ActionController::Base | |
# protect_from_forgery with: :exception | |
respond_to :json, :html | |
before_action :authenticate_user! | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
class User < ApplicationRecord | |
# Include default devise modules. Others available are: | |
# :confirmable, :lockable, :timeoutable and :omniauthable | |
devise :invitable, :database_authenticatable, :registerable, | |
:recoverable, :rememberable, :trackable, :validatable, | |
:jwt_authenticatable, jwt_revocation_strategy: Devise::JWT::RevocationStrategies::Null | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'devise-jwt' | |
gem 'rack-cors' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config.jwt do |jwt| | |
jwt.secret = ENV['DEVISE_JWT_SECRET_KEY'] | |
jwt.request_formats = { | |
user: [:json] | |
} | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config.middleware.insert_before 0, Rack::Cors do | |
allow do | |
origins '*' | |
resource '*', | |
:headers => :any, | |
:methods => [:get, :post, :options], | |
expose: %w(Authorization) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
class SessionsController < Devise::SessionsController | |
def create | |
super { @token = current_token } | |
end | |
private | |
def current_token |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for branch in $(git branch -vv | grep 'origin/.*: gone]' ) ; do git branch -D $branch ; done ; |