But with this code i have to authenticate every time when i try to
access the website..

I have this code for authenticate:

 def authenticate
        case request.format
        when Mime::XML, Mime::ATOM
          if self.user = authenticate_or_request_with_http_basic { |u,
p| User.authenticate(u, p) }
            @current_user = user
          else
            request_http_basic_authentication
          end
        else
          user = User.find_by_remember_token(cookies[:auth_token])
        end
      end

But when i try to access an xml resource i get the authentication
dialog and i get a page with error (ouldn't find Profile without an
ID)
and when i refresh i get the right xml page.. How can i fix this.. My
authentication doesnt work because of this on android!

Thank you

On Jul 16, 8:36 pm, Andrew <luckyd...@gmail.com> wrote:
> def authenticate
>   �...@current_user = authenticate_or_request_with_http_basic { |u, p|
> User.authenticate(u, p) }
> end
>
> Use as a before filter.
>
> On Jul 16, 11:18 am, Wouter <wouterg...@gmail.com> wrote:
>
> > Can you post your code how you fixed it please!
> > I am using also restful authentication and want to provide basic
> > authenticaton for xml!
>
> > Thank you
>
> > Wouter
>
> > On 18 jun, 19:06, Matt Jones <al2o...@gmail.com> wrote:
>
> > > There's already support for basic auth in restful-authentication; it
> > > only gets used by default for (off the top of my head) JSON and XML
> > > formatted requests. The support is pretty simple - take a look at (in
> > > restful_auth) AuthenticatedSystem#access_denied, and also the core
> > > docs for ActionController::HttpAuthentication.
>
> > > --Matt Jones
>
> > > On Jun 17, 9:59 pm, Andrew <luckyd...@gmail.com> wrote:
>
> > > > I'm developing an API for my site, and I'm wondering how I can make it
> > > > so requests require basic access authentication (like in Twitter's API
> > > > for example)? I'm using restful-authentication on Rails 2.3.2. Thanks!
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to