# Rails authentication from non-web interface

**URL:** <https://www.ruby-forum.com/t/rails-authentication-from-non-web-interface/190282>\
**Category:** Rails\
**Created:** [June 17, 2010, 4:22pm UTC](https://www.ruby-forum.com/t/rails-authentication-from-non-web-interface/190282 "2010-06-17T16:22:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![builtbysimple](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/aca169/32.png) [@builtbysimple](https://www.ruby-forum.com/u/builtbysimple)\
**Post date:** [June 17, 2010, 4:22pm UTC](https://www.ruby-forum.com/t/rails-authentication-from-non-web-interface/190282/1 "2010-06-17T16:22:40Z")

</div>

Hi all,

I want to authenticate my mobile phone apps to my online Rails apps.  
What would be the best approach to do this? Can anybody give  
suggestion both on how I should do it in the mobile app and in the  
rails app?

Thank you very much for your help.

Kind regards,  
Joshua

–  
[http://twitter.com/scrum8](http://twitter.com/scrum8)

---

<div class="post-metadata">

**Author:** ![builtbysimple](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/aca169/32.png) [@builtbysimple](https://www.ruby-forum.com/u/builtbysimple)\
**Post date:** [June 17, 2010, 4:22pm UTC](https://www.ruby-forum.com/t/rails-authentication-from-non-web-interface/190282/2 "2010-06-17T16:22:41Z")

</div>

Hi Joshua,

On Mon, Jun 14, 2010 at 7:12 AM, Joshua P.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi all,
> 
> I want to authenticate my mobile phone apps to my online Rails apps.  
> What would be the best approach to do this? Can anybody give  
> suggestion both on how I should do it in the mobile app and in the  
> rails app?

I’ve got a similar situation with 2 apps, both Rails apps, where the  
one making the request uses the Ruby Net::HTTP library to send its  
requests, authenticating using BasicAuth inside SSL. The requests are  
made to a RESTful interface so the receiving Rails app doesn’t  
distinguish, except in terms of the format of the response, between  
getting the request from a browser or an app.

HTH,  
Bill

---

<div class="post-metadata">

**Author:** ![builtbysimple](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/aca169/32.png) [@builtbysimple](https://www.ruby-forum.com/u/builtbysimple)\
**Post date:** [June 17, 2010, 4:26pm UTC](https://www.ruby-forum.com/t/rails-authentication-from-non-web-interface/190282/3 "2010-06-17T16:26:24Z")

</div>

Hi Bill,

Thank you for the hint and explanation. That really helps. I will try  
from here. =)

Kind regards,  
Joshua.

---

<div class="post-metadata">

**Author:** ![builtbysimple](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/aca169/32.png) [@builtbysimple](https://www.ruby-forum.com/u/builtbysimple)\
**Post date:** [June 17, 2010, 4:35pm UTC](https://www.ruby-forum.com/t/rails-authentication-from-non-web-interface/190282/4 "2010-06-17T16:35:19Z")

</div>

Yeah, I am working on exactly similar project and using http basic  
auth over https.  
Though what is the best way to disable cookies and session management  
in rails as these are not required  
in the above approach.

Thanks  
Gopal

---

<div class="post-metadata">

**Author:** ![builtbysimple](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/aca169/32.png) [@builtbysimple](https://www.ruby-forum.com/u/builtbysimple)\
**Post date:** [June 17, 2010, 4:27pm UTC](https://www.ruby-forum.com/t/rails-authentication-from-non-web-interface/190282/5 "2010-06-17T16:27:02Z")

</div>

On Mon, Jun 14, 2010 at 8:12 AM, Joshua P.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi all,
> 
> I want to authenticate my mobile phone apps to my online Rails apps.  
> What would be the best approach to do this? Can anybody give  
> suggestion both on how I should do it in the mobile app and in the  
> rails app?

## I’d set the rails app to accept http basic authorization over https, and have the mobile app store the user’s password.

Rick DeNatale

Blog: [http://talklikeaduck.denhaven2.com/](http://talklikeaduck.denhaven2.com/)  
Github: [rubyredrick (Rick DeNatale) · GitHub](http://github.com/rubyredrick)  
Twitter: @RickDeNatale  
WWR: [http://www.workingwithrails.com/person/9021-rick-denatale](http://www.workingwithrails.com/person/9021-rick-denatale)  
LinkedIn: [http://www.linkedin.com/in/rickdenatale](http://www.linkedin.com/in/rickdenatale)
