How to handle login correctly in an iPhone app that connects to a web service

I am currently designing an iPhone app. It uses a web api that I’m building in PHP. The app requires users to login.

What I am currently researching, and having a really hard time figuring out, is if there is a “proper” way to do this.

At this point, I have it so that new users can register right within the app, providing their email and a password. This password is salted (with a static salt – I know – a bad thing, but better than no salt), and then hashed before being sent to the api.

Registration, and login works fine. However, wanting to be as security conscientious as possible, I’m trying to figure out if there is a more secure, industry-standard way to do this.

The app requires the login data to live on the server, and not on the device. I may add a web interface later, and the user will need to be able to log in there as well.  Because of this, using a random salt for each app install, while more secure, as far as I can tell, will prevent web login since the salt will only exist on the device.

Someone has said use OAuth, and I would love to pursue that, but I can not find a single *simple* example of how to use it. Sure, there are plenty of high level “Here’s how OAuth works” types of tutorials out there, but it seems that no one has written a *simple* tutorial on this exact use-case.

If I could figure it out, I might just do it myself. However, I’m not sure if OAuth is the right tool in this case.

As I understand OAuth, it allows a user to login to my app using another site’s credentials, such as Google, Facebook, Twitter, etc. They authenticate through that other service, and that service passes me a token to use to identify them in the future.

If I’m understanding it correctly, that would be fine. As long as I have  a way to identify them, I don’t care how it happens. In fact, I like the idea of letting someone else handle the heavy lifting (security).

So, where do I begin?

At this point, I have no idea. I have seen several projects people have written to “encapsulate” OAuth for Objective C at a “high-level”, but they are anything but simple, and I can’t make any sense of them. Do you really need a degree in computer science just to understand this stuff?

Comments and assistance welcome.

 

iPhone: CLLocation: Get current location

Steps to basic geolocation:

1. Add CLLocation framework to Build Phases, Link Binary with Libraries

2. Set up instance variable in .h file:

CLLocationManager *locationManager;

 

3. Instantiate and set up location manager in the .m file:

locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
locationManager.distanceFilter = kCLDistanceFilterNone;
locationManager.desiredAccuracy = kCLLocationAccuracyBest;

4. Inside the button handler:

[locationManager startUpdatingLocation];

 

This tells the location manager to start updating.

5. This function gets called by the location manager. It is like a callback. The location manager will call this function every time the location is updated.

- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
    CLLocation *currentLocation = newLocation;
    NSLog(@"%@", currentLocation);
}

All this does in this case is dump the data to the debug window.