3 Replies Latest reply on Jul 29, 2013 1:50 AM by Vidyaa Natarajan

    404 error while connecting from Rhodes to Rhoconnect application

      Hi All,

       

      I am new to Rhoconnect application. I was using Rhosync. Now I am using Rhodes and Rhoconnect (4.0.0 beta.24) version.

       

      When I run my Rhodes application and trying to login to server, I am getting the  "404 error" error in my Rholog.txt file.

       

      The following is my authenticate method in Application_Controller of Rhoconnect application.

       

      class ApplicationController < Rhoconnect::Controller::AppBase
        register Rhoconnect::EndPoint  
            def authenticate(username,password)
                  server = "http://localhost:9292"
                 login = "login"
                 password = "password"
                  puts"========#{login}====="
                   @api_token = RestClient.post("#{server}/mobile/login", { :login => 
                  login, :password=> password }.to_json, :content_type => :json)
                  puts "=============apiii------------#{@api_token}"
           end
      end

       

      I am not getting the puts in the Rhoconnect server.

       

      I have given the following line in my Rhodes Settings_controller to connect to server.

       

      SyncEngine.login(@params['login'], @params['password'], (url_for :action => :login_callback, :query => {:newuser_name => @params['login'],:newpassword => @params['password']}) )

      Is there I am missing some code?

       

      Please help me to fix this issue.

       

      Thanks,

      Vidyaa.N

        • Re: 404 error while connecting from Rhodes to Rhoconnect application

          Are you using a rhodes/rhoelements 4 beta build?  You need a rhodes 4+ client to talk to a rhoconnect 4 server.  Just make sure to drop  the "/application" from the end of your syncserver setting in rhoconfig.txt.

          • Re: 404 error while connecting from Rhodes to Rhoconnect application

            class ApplicationController < Rhoconnect::Controller::AppBase
              register Rhoconnect::EndPoint  
                  def authenticate(username,password)
                        server = "http://localhost:9292"
                       login = "login"
                       password = "password"
                        puts"========#{login}====="
                         @api_token = RestClient.post("#{server}/mobile/login", { :login => 
                        login, :password=> password }.to_json, :content_type => :json)
                        puts "=============apiii------------#{@api_token}"
                 end
            end

             

             

            This syntax is incorrect, the application_controller is a sinatra controller with routes now, so it should look more like this:

             

            class ApplicationController < Rhoconnect::Controller::AppBase
              register Rhoconnect::EndPoint
            
            
              post "/login", :rc_handler => :authenticate,
                             :deprecated_route => {:verb => :post, :url => ['/application/clientlogin', '/api/application/clientlogin']} do
                login = params[:login]
                password = params[:password]
                true # do some interesting authentication here...
              end
            
            
              get "/rps_login", :rc_handler => :rps_authenticate, 
                                :login_required => true do
                login = params[:login]
                password = params[:password]
                true # optionally handle rhoconnect push authentication...
              end
            end