# http basic authentication and restful authentication

**URL:** <https://discuss.rubyonrails.org/t/http-basic-authentication-and-restful-authentication/44305>\
**Category:** rubyonrails-talk\
**Created:** [July 16, 2009, 2:37pm UTC](https://discuss.rubyonrails.org/t/http-basic-authentication-and-restful-authentication/44305 "2009-07-16T14:37:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wouter1](https://avatars.discourse-cdn.com/v4/letter/w/85e7bf/32.png) [@Wouter1](https://discuss.rubyonrails.org/u/Wouter1)\
**Post date:** [July 16, 2009, 2:37pm UTC](https://discuss.rubyonrails.org/t/http-basic-authentication-and-restful-authentication/44305/1 "2009-07-16T14:37:16Z")

</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:

&nbsp;&nbsp;&nbsp;&nbsp;def login\_from\_basic\_auth &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;authenticate\_or\_request\_with\_http\_basic do |username, password| &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self.user = User.authenticate(username, password) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end &nbsp;&nbsp;&nbsp;&nbsp;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:** ![Wouter1](https://avatars.discourse-cdn.com/v4/letter/w/85e7bf/32.png) [@Wouter1](https://discuss.rubyonrails.org/u/Wouter1)\
**Post date:** [July 22, 2009, 9:09am UTC](https://discuss.rubyonrails.org/t/http-basic-authentication-and-restful-authentication/44305/2 "2009-07-22T09:09:21Z")

</div>

Please help me!

Thanx
