The Slim Framework support forum has moved to This Tender forum is no longer maintained or monitored.


kishore's Avatar


02 Apr, 2012 06:27 PM

How to make this API work only with HTTPS?
How to implement Authentication (Basic Auth) in this framework?

  1. Support Staff 1 Posted by Josh Lockhart on 02 Apr, 2012 06:29 PM

    Josh Lockhart's Avatar

    Serving your app over HTTPS is largely based on your web server configuration. In your Slim app, you should ensure your HTTP cookies (if you use any) are set with the httpOnly and secure flags.

  2. Support Staff 2 Posted by Josh Lockhart on 02 Apr, 2012 06:31 PM

    Josh Lockhart's Avatar

    Basic auth... you can use a before hook to inspect the Request object. You can see an example HTTP basic auth example (not using Slim) on PHP's site here:

    This gives you an idea of what the Response headers and status should be. I do intend to write middleware for HTTP auth once I get 1.6.0 out the door.

  3. 3 Posted by Kishore on 06 Apr, 2012 07:14 PM

    Kishore's Avatar

    @josh. Thanks. Started loving this framework. Would love to see lot of development activity on this.

  4. 4 Posted by KC on 01 May, 2012 07:06 PM

    KC's Avatar

    Hey Josh - Awesome framework, you absolutely rock. You mentioned that with 1.6.0 out the door you were hoping to write some middleware to support HTTP auth. I'm wrapping up some work on the API and auth is next. Id much prefer to use something you've written than something I've hacked together. Any idea if you're still planning to write it and if so, any idea of a timeline? Thanks again!

  5. Support Staff 5 Posted by Josh Lockhart on 01 May, 2012 07:10 PM

    Josh Lockhart's Avatar

    I haven't started just yet, but I can try to have it available in the Slim-Extras repo in a week or so.

  6. 6 Posted by KC on 01 May, 2012 07:13 PM

    KC's Avatar

    @josh you're awesome. thanks so much, I'll feel better using your code!

  7. Support Staff 7 Posted by Josh Lockhart on 01 May, 2012 07:43 PM

    Josh Lockhart's Avatar

    While I was thinking about it, went ahead and put together a quick middleware class. It's available in the Slim-Extras repo. Read the inline docs for usage info.

  8. Josh Lockhart closed this discussion on 01 May, 2012 07:43 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac