Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7188331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:03:33+00:00 2026-05-28T19:03:33+00:00

I’m running devise on a web server and I’m trying to get a Java

  • 0

I’m running devise on a web server and I’m trying to get a Java application to authenticate. After the application is authenticated, devise should authorize the application to create and update records on the web server.

I’m looking at the rails server log, to compare what the web form is posting versus my application. Here are the different outputs:

Web Form (Working)

Parameters: {“utf8″=>”Γ£ô”, “authenticity_token”=>”vYC9qd0dVIUH7B/wCHW59JwZquX4yaiogXZ32pbn1So=”, “user”=>{“username”=>”user”, “password”=>”[FILTERED]”, “remember_me”=>”0”}, “commit”=>”Sign in”}

Application (Not Working)

Parameters: {“utf8″=>”?”, “username”=>”user”, “password”=>”[FILTERED]”, “commit”=>”Sign in”}

This is my app’s code

    public void webLogin(String methodName, String username, String password) {        
        httpPost = new HttpPost(webServiceUrl+methodName);

        try {
            // Add your data
            List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
            nameValuePairs.add(new BasicNameValuePair("utf8", Character.toString('\u2713')));
            nameValuePairs.add(new BasicNameValuePair("username", username));
            nameValuePairs.add(new BasicNameValuePair("password", password));
            nameValuePairs.add(new BasicNameValuePair("commit", "Sign in"));
            httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs));

            // Execute HTTP Post Request
            HttpResponse response = httpClient.execute(httpPost);

        } catch (ClientProtocolException e) {
            // TODO Auto-generated catch block
        } catch (IOException e) {
            // TODO Auto-generated catch block
        }
    }

The obvious difference is that the username and password are nested into a user structure. So my question is, how do I create that structure?

EDIT HTTP Header Info

    Request URL:http://localhost:3000/users/sign_in
    Request Method:POST
    Status Code:302 Found
    Request Headersview source
    Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
    Accept-Encoding:gzip,deflate,sdch
    Accept-Language:en-US,en;q=0.8
    Cache-Control:max-age=0
    Connection:keep-alive
    Content-Length:197
    Content-Type:application/x-www-form-urlencoded
    Cookie:_WebApp_session=BAh7CEkiCmZsYXNoBjoGRUZvOiVBY3Rpb25EaXNwYXRjaDo6Rmxhc2g6OkZsYXNoSGFzaAk6CkB1c2VkbzoIU2V0BjoKQGhhc2h7BjoKYWxlcnRUOgxAY2xvc2VkRjoNQGZsYXNoZXN7BjsKSSIfSW52YWxpZCBlbWFpbCBvciBwYXNzd29yZC4GOwBUOglAbm93bzokQWN0aW9uRGlzcGF0Y2g6OkZsYXNoOjpGbGFzaE5vdwY6C0BmbGFzaEAHSSIPc2Vzc2lvbl9pZAY7AEZJIiU4ODVjM2QxNmNkMTI4YWYxN2E5YzEyNmRjYWI1OTI1YgY7AFRJIhBfY3NyZl90b2tlbgY7AEZJIjFNVkV4aFNoSnZsQmhxRUFVdjZtZ0ZBblNVQzJjbU1Kb0l3N1U1OHErNUlVPQY7AEY%3D--8b8a1fcee6c194b938781fa60ddb3a91b1ac8c7c
    Host:localhost:3000
    Origin:http://localhost:3000
    Referer:http://localhost:3000/users/sign_in
    User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.75 Safari/535.7
    Form Dataview URL encoded
    utf8:✓
    authenticity_token:MVExhShJvlBhqEAUv6mgFAnSUC2cmMJoIw7U58q 5IU=
    user[username]:user
    user[password]:password
    user[remember_me]:0
    commit:Sign in
    Response Headersview source
    Cache-Control:no-cache
    Connection:Keep-Alive
    Content-Length:88
    Content-Type:text/html; charset=utf-8
    Date:Thu, 26 Jan 2012 03:57:57 GMT
    Location:http://localhost:3000/
    Server:WEBrick/1.3.1 (Ruby/1.9.2/2011-07-09)
    Set-Cookie:_WebApp_session=BAh7CUkiCmZsYXNoBjoGRUZvOiVBY3Rpb25EaXNwYXRjaDo6Rmxhc2g6OkZsYXNoSGFzaAk6CkB1c2VkbzoIU2V0BjoKQGhhc2h7ADoMQGNsb3NlZEY6DUBmbGFzaGVzewY6C25vdGljZUkiHFNpZ25lZCBpbiBzdWNjZXNzZnVsbHkuBjsAVDoJQG5vd286JEFjdGlvbkRpc3BhdGNoOjpGbGFzaDo6Rmxhc2hOb3cGOgtAZmxhc2hAB0kiD3Nlc3Npb25faWQGOwBGSSIlYmZkMDkwNDA1ZGZkN2JmZTA1OWM0MDNmZDIxYzU1ODMGOwBUSSIQX2NzcmZfdG9rZW4GOwBGSSIxTVZFeGhTaEp2bEJocUVBVXY2bWdGQW5TVUMyY21NSm9JdzdVNThxKzVJVT0GOwBGSSIZd2FyZGVuLnVzZXIudXNlci5rZXkGOwBUWwhJIglVc2VyBjsARlsGaQciIiQyYSQxMCR0b0tHc0FJTWpHRXQxSXp1aWVCRlBl--9e1e39fb97a4452e3693c65cc5f1ac4ad9855c37; path=/; HttpOnly
    X-Runtime:0.231013
    X-Ua-Compatible:IE=Edge
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T19:03:34+00:00Added an answer on May 28, 2026 at 7:03 pm

    Seeing as to what kind of request is working, I’d try this:

    nameValuePairs.add(new BasicNameValuePair("authenticity_token", myToken));
    nameValuePairs.add(new BasicNameValuePair("user[username]", username));
    nameValuePairs.add(new BasicNameValuePair("user[password]", password));
    nameValuePairs.add(new BasicNameValuePair("user[remember_me]", 0));
    nameValuePairs.add(new BasicNameValuePair("commit", "Sign in"));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I'm trying to create an if statement in PHP that prevents a single post
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.