If the purpose of the Sinatra app is just an API, you probably need to
configure HTTP basic auth anyway.  I don't think handling authentication
there as well would be a bad thing or much duplication.

I actually did something similar last week -- my app uses Devise, but you
should be able to adjust the authenticate() method for Authlogic -- I'm
guessing you can use UserSessions.create(email, password) or something along
those lines instead:
https://gist.github.com/1056354

In case it's not obvious, permit_authentication will accept auth if it's
provided, authenticate! requires it.  You'll want to implement the halt
error methods.  Hope this helps!

James

On Thu, Jun 30, 2011 at 12:53 AM, Guyren Howe <[email protected]> wrote:

> I have some logic that’s part of a Rails app that I’d like to separate. A
> Sinatra app seems mostly like it might work. The thing just provides a
> pretty simple API.
>
> I can write the API pretty nicely in Sinatra, but the problem is
> authentication. My Rails app uses authlogic for authentication. And it’s not
> at all clear to me that it can be easily made to work nicely with Sinatra.
>
> The Sinatra app will be sharing the back end with the Rails app. I’d like
> it to be able to run either within the same Rack stack as Rails, or as a
> separate application.
>
> I guess it wouldn’t be terribly difficult to work out what sort of hash
> authlogic uses, and just replicate that logic, but that’s inelegant.
>
> Thoughts?
>
> --
> SD Ruby mailing list
> [email protected]
> http://groups.google.com/group/sdruby

-- 
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby

Reply via email to