# Http basic authentication and restful authentication

**URL:** <https://www.ruby-forum.com/t/http-basic-authentication-and-restful-authentication/172198>\
**Category:** Rails\
**Created:** [July 16, 2009, 4:38pm UTC](https://www.ruby-forum.com/t/http-basic-authentication-and-restful-authentication/172198 "2009-07-16T16:38:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![wouter](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/e99b99/32.png) [@wouter](https://www.ruby-forum.com/u/wouter)\
**Post date:** [July 16, 2009, 4:38pm UTC](https://www.ruby-forum.com/t/http-basic-authentication-and-restful-authentication/172198/1 "2009-07-16T16:38:18Z")

</div>

hey,

I have created a web app in Ruby On Rails and users can login and  
register with resftul authentication.  
Now I am creating an Android application where the user can access  
some parts of the website (xml resources).  
To access these xml files with HTTP GET Request the username and  
password from the user has to be sended with this request to  
authenticate the user. Now this can be done with http basic  
authentication but when i put this code in my authentication file:

```
def login_from_basic_auth
  authenticate_or_request_with_http_basic do |username, password|
    self.user = User.authenticate(username, password)
  end
end

```

i only can login at my site when i fill in username and password in a  
dialogue. How can I disable this so the user at the website can login  
normally trough login form (and register) and only enable the login  
with basic authentication for request from my android application?

How can a user register on my site when he has to fill in first a  
username and password…

Please help me,

Thank you

Wouter

---

<div class="post-metadata">

**Author:** ![wouter](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/e99b99/32.png) [@wouter](https://www.ruby-forum.com/u/wouter)\
**Post date:** [July 22, 2009, 11:10am UTC](https://www.ruby-forum.com/t/http-basic-authentication-and-restful-authentication/172198/2 "2009-07-22T11:10:13Z")

</div>

Please help me!

Thanx
