0

I was wondering if there was a way to force an iOS device to login to a php page each time they send a request to the page.

Currently, after I log in the first time, I have to restart the application to force it to ask for credentials to be sent again. I have tested this behaviour with a webpage, and after the login prompt shows and I enter the password correctly, I do not have to enter it until I restart the browser and go to the page again.

I was wondering if there is any way to change this behaviour either server or client side to force the server to request credentials every time a request is sent.

Ignacy Debicki
  • 437
  • 4
  • 18

2 Answers2

0

If information about being logged in are stored in session (which I think it is - but it depends on application) you can f.e. reset session after each request.

In other words: run same action that will be run when user is logging out, but after every request.

Esse
  • 3,278
  • 2
  • 21
  • 25
  • thanks for the reply. It works. Used the suggetions for logging out here when using basic: http://stackoverflow.com/questions/233507/how-to-log-out-user-from-web-site-using-basic-authentication – Ignacy Debicki Oct 25 '14 at 20:13
0

As much as Esse's answer is good for server side, I found an easier workaround client-side, setting the NSURLCredential storage to NSURLCredentialPersistenceNone. This stops the phone from storing the basic auth credentials. As this site is not intended to be used by browser's this is a decent work around

Ignacy Debicki
  • 437
  • 4
  • 18