so I have a little complicated combination here.
Company has many Users User belongs to Company
User is managed for authentication using
class User < ActiveRecord::Base belongs_to :company devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable
You can log in as a user and create objects that belong to the Company and not to the user, for example: Text . ( company.texts )
I have now created a simple API using the acts_as_api . for this I just have to change my text controller, i.e. show action.
class TextsController < ApplicationController load_and_authorize_resource def show
this works very well on a website. the problem is the API. I do not want to authenticate when accessing the api through the user model. the company has an attribute called :hash , which I want to use for Auth in the API.
I do not know how to achieve this using devise (or any other method). therefore, by default, the developer wants the user to log in due to load_and_authorize_resource in my controller, which is great for an html response, but not for a json response.
any ideas?
thanks for this. please leave a comment if something is unclear!
source share