How to handle authentication callback in an API backend? Rails API + React Fronetend + Facebook -


i have rails 5 api backend. have 2 routes such:

  # facebook link url   # /accounts/facebook_url   def facebook_url     @oauth = koala::facebook::oauth.new(       env['facebook_app_id'],       env['facebook_secret'],       facebook_callback_accounts_url     )     # @oauth.url_for_oauth_code # create oauth url     url = @oauth.url_for_oauth_code     render json: url # hanlde using serializer?   end    # facebook post url code   # /accounts/facebook_callback?code=fadsdfaadsf   def facebook_callback     @oauth = koala::facebook::oauth.new(       env['facebook_app_id'],       env['facebook_secret'],       facebook_callback_accounts_url     )     token = @oauth.get_access_token(params[:code])   end 

in react app, url authentication facebook_url route , redirect user route. facebook send me token. able point. problem how frontend know token received or not?

if rails application, use different redirects based on status. seems more architecture based question rather rails specific. appreciated.


Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -