I run a very expensive data driven website which has two mobile apps and a web app.
The first mobile app and associated web app require registration, while the other doesn't. I wanted a way that the users of the free mobile app would have accounts created behind the scenes that I could later associate an email with when they registered in the app that they could use to login on the website.
Both apps use a API, accessible via XML with a authlogic single use token. This module allows user sessions to be created with just an iPhone/iPod UDID, which create associated users that I can later associate an email and password with, allowing them to login on the main website and registration-required mobile app. It also allows me to track usage by UDID and ban users, if I needed to based on their usage.
Install and use
1. Install the authlogic_udid plugin
$ script/plugin install git://github.com/cmeiklejohn/authlogic_udid.git
2. Make some database changes
$ script/generate migration add_udid_to_user udid:string $ rake db:migrate
3. Change your acts_as_authentic call to turn of stock validations
acts_as_authentic do |config| config.validate_email_field = false end
These will be replaced by validate_email_or_udid_field, which defaults to true and allows nil for email.
If your session module is called UserSession, normally via XML the request would be similar to:
user_session email/ password/ /user_session
With this module, it will be:
user_session udid/ /user_session
AuthlogicUDID is Copyright 2010 Christopher Meiklejohn.
It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file, which is attached below:
Copyright (c) 2010 Christopher Meiklejohn Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Copyright (c) 2010 Christopher Meiklejohn, released under the MIT license.