Setup :
- Front end => React Native
- Back end => Rails API
Context: I'm trying to create a user authentication flow using devise & devise-token-auth. My routes and requests seem to be working in the rails console & using Postman however I would like to now generate the responses to use in my frontend.
Key Question: How do I check if the signup params:
- 1) have been entered
- 2) are valid
- 3) aren't duplicates
and then render a JSON status code that can be used in my front end?
module Users
class RegistrationsController < Devise::RegistrationsController
...
# POST /resource
def create
if params['user']['uid'].nil? && params['user']['provider'].nil?
configure_permitted_parameters
params['user']['uid'] = params['user']['email']
params['user']['provider'] = 'email'
end
super
end
end
...