A3M has been updated: http://blog.biernacki.ca/2012/07/a3m-updated-to-latest-codeigniter-v2-1-2-named-pbj/.
Please be aware, that this guide is currently outdated.

Example of a3m login form utilizing openidSo I became interested in creating a CodeIgniter openid application.  I really like the concept having used StackOverflow so long, that I decided to start looking for a means to do it.  After some searching and StackOverflow posting, I found a3m.

A3M in a nutshell

a3m is a great OpenID module for CodeIgniter, and what really sold me on it was it’s complete support of all the major openid providers (google, yahoo, myspace, facebook, etc).  It allows you to just build on it and not worry about the typical CRUD that developers go through in regards to user accounts. I’m really glad that I can take something, plug it in, and run with it, building my web application without building the ground work for user connections, something that as a developer you typically have to re-build on EVERY project.

Overall, it gives users a convenient means of connecting with my application, they don’t need to make yet another username/password that they might forget, or just make really weak security wise.

Problems with a3m?

Main issue I found with a3m, is that the developer didn’t have time to fully document the installation of said application. Maybe in the future with a full 1.0 release we will have a complete easy to use guide, but for now my post here aims for that documentation goal. Anyway, it basically comes down to a couple things, but having gone through google searches, and codeigniter forum posts, I can tell you people keep making the same installation mistakes during installation/config.

So the documentation is pretty poor when it comes to this app.  I hope with this post to at least give you a better starting position and eliminate some of the small user created issues (read.. not bugs!).

Oh and lastly, the project is questionable right now due to lack of ‘movement’ since March 2010 (as of this post). So hopefully the developer will contribute some updates.

How to start

  1. Download a3m (which comes already with CodeIgniter 1.7.2 — as of this posting)
  2. Extract the contents into your web directory (using an unzip app like 7zip). Personally I put everything into the root, and didn’t use the ‘a3m’ folder.
  3. Using a mysql client (phpmyadmin or a desktop version like heidi sql), create a database and import the application data from the ‘a3m/a3m.sql’ file.
  4. Once the database is setup, create a unique user account / password to access said database (you will need this for the next section).

Configs & Permissions

So now you’ve got the app extracted, you have your database prepared, privileges setup and ready to be used by your application, all you have to do is modify the configs to reflect your setup.

  1. Edit the following file /system/application/config/database.php and modify your settings just like you would for any CodeIgniter project.
  2. (optional) Modify your .htaccess file if you were like me and put the application into the root directory of your website (remove a3m folder reference).
  3. (optional) If your server / apache / webhost is on a linux box, you will need to modify some permissions on your folder structure.  I learned this through trial and error as no openid / google / yahoo account would validate (It couldn’t store the data locally in the cache).
    I chown’ed the following folders and put them assigned www-data ownership (lets Apache have read/write access) :
    /uploads/ (all your images / user uploaded content)
    /system/cache/ (critical for openid nonces)
  4. With permissions set (optional) and the database configured, you only have one more things to edit, and this takes place inside the /system/application/modules/account/config/ folder, so lets edit account.php
  5. account.php needs to be configured, so that you can actually play with your a3m setup.  In my case, I wanted to develop the app without any SSL or reCaptcha support out of the box (by default those 2 are enabled (which breaks your login process as it tries to redirect you to the https site or enable reCaptcha), so lets disable them:
    $config['ssl_enabled'] = FALSE;
    $config['sign_in_recaptcha_enabled'] = FALSE;
    $config['sign_up_recaptcha_enabled'] 	= FALSE;
    $config['sign_up_auto_sign_in'] 	= FALSE;
    $config['sign_up_recaptcha_enabled'] = FALSE;
    $config['sign_up_auto_sign_in'] = FALSE;

    also while we are in there, you can configure your outbound password recovery email:

    $config['password_reset_email'] = 'no-reply@reset.website.com';

All done…

And there you have it.  Config’s are all done with (for a basic start at least).  Simply navigate now to your website and enjoy testing the a3m interface.  I created some fake demo accounts to test with, one of my favorite openid ones to test with is https://www.myopenid.com/ so start there if you want to create a quick account and test with.  You can then begin building your CodeIgniter application, while utilizing the a3m module for all your login needs.

If you run into problems always refer to your apache / php logs and find out the cause.  If it is simply failing to validate your openid account (even tho you signed in) you need to verify your permissions on the cache folder.

22 Comments to “A3M – A CodeIgniter Account Authentication & Authorization Module Installation”

  1. James Leven | November 29th, 2010 at 8:37 PM

    Glad someone finally wrote a tutorial helping to setup the library, however I was hoping for SOME documentation, as you mentioned is the major flaw. So you know, how to get it going and recognizing peoples usernames/other info, how to do things and treat them as members, etc.

    Either way, cheers to a nice setup tutorial.

  2. Christian Marth | November 29th, 2010 at 9:57 PM

    Very Nice post, Just what i was looking for to tie all the A3M pieces together nicely, Well Done!

  3. Jakub | November 29th, 2010 at 11:04 PM

    @James Leven:

    A3m’s goal is to give you the ‘tie-in’ for account signup / registration. From here on out, you can build on the app just like you would with any CodeIgniter project, add a permission table (roles), create an administration section to ban users, etc. From the roadmap, I read that a3m should support something like this in the future, but I am not aware of it being possible now. You are basically on your own after the installation.

    My main goal was to utilize a3m as an easy way for my users to log in/out of my web app. I am working on the backend for management / functionality on my own. Stay tuned, maybe I will provide a modification that might benefit some people, but no promises. 😉

  4. @jontroth | December 2nd, 2010 at 10:40 AM

    Great walk through!

    I haven’t seen any activity on the code since March 2010 … though I am hoping and looking forward to a new CI2 version. 🙂

    Not to turn anyone away from A3M, but Pat Andrew has put together a nice package for CI2 called Mauth. And it looks as though he’ll be adding other features like OAuth and OpenID soon.

    You can download it from http://bitbucket.org/missionsix/mauth/src in case you are curious.

  5. next2u | December 17th, 2010 at 11:47 AM


    I just get “Disallowed Key Characters.” and no more information about the real error … .

    Regards N.

  6. pk | December 18th, 2010 at 5:10 AM

    hey guys,

    thanks for your interest in a3m.
    jakub thanks for writing this post.
    i’ve made jakub the project owner of the open source a3m code on google code. we can fix and improve from there collaboratively. jakub can add more collabators as he see fit from now on.

    i’ve been quiet since mar but i been using a3m in many ways and have learn much about its short comings and more. jakub can we start a google group mailing list of a3m? things like acl, oauth are not stable in the a3m avaliable now. everything else should be fairly stable (tho of cause many small here-and-there improvement are needed)

    contact me at pengkong@mail.com if needed

  7. Jakub | December 18th, 2010 at 6:43 PM

    @next2u, here are some details for you to check with, might be because you are running a localhost install with a host file modification, details here:


  8. Dan LaManna | December 20th, 2010 at 5:37 PM

    Hey man, great tutorial to get people started. I guess my main issue is I already had my custom .htaccess for getting mod-rewrite to work. Now I’m left clueless as to how to get it working, I took all the files out of the a3m download that were different from my pre-existing CI installation and placed them in the appropriate places, is there a better way of doing it?

  9. pk | January 4th, 2011 at 6:29 AM

    hey guys, i’ve just release v1.0 of a3m.


    still in the process of creating wiki help pages.

  10. Mindtricks | April 20th, 2011 at 4:08 AM


    Can you provide us with example code for the backend you’re working on?

  11. Jakub | April 22nd, 2011 at 5:22 PM

    @Mindtricks, I will try to release some of the code that I have, what I have done is strip out the ‘login/password’ model from the a3m, because I quite frankly want a PURE openid solution. So I removed all that garbage. Also I hate some of the structure that a3m has (stored in modules, hidden away somewhere – views / controllers / etc).

    I removed all those. And it works beautifully, however as I was working on this PK released the updated version of all the code, so I’m sure some things are a bit outdated (I honestly haven’t had time to try the new code yet). So keep in mind the stuff I use is setup for CI2.0.X with the pre-CI2 a3m package reorganized.

  12. zuko | May 6th, 2011 at 8:39 AM

    Any similar just PHP library?

  13. Mohit Bumb | May 2nd, 2012 at 9:36 AM

    huh cool thanks man got your link from stack overflow

  14. Aadgxfhf | July 10th, 2012 at 10:38 PM


  15. -Johan Ferdianto | July 22nd, 2012 at 3:17 PM

    Thankyou very much brother…,

  16. Shivaraj RH | October 10th, 2012 at 6:33 AM

    hello, I request you to provide steps or documentation for
    How to integrate in my existing CI projects?

  17. Jakub | October 21st, 2012 at 7:59 PM

    @Shivaraj as this guide is outdated, take a look at the github source, and look at what can be ported over (effectively you grab the openid / auth models + libraries). https://github.com/pengkong/A3M-for-CodeIgniter-2.0

  18. Online Strategies | March 20th, 2013 at 12:10 AM

    Great tutorial. I am trying this but now getting error when connecting to facebook it throws error “An error occurred. Please try again later.

  19. tutaj | May 8th, 2015 at 5:41 PM

    This post gives clear idea in favor of the new viewers of blogging, that really how to do
    running a blog.

  20. Tanaka | December 20th, 2015 at 4:14 PM

    Hi Ian,the thread you lienkd to at the CI forums does require a login. It would really help me out if you could actually post your solution?Your help is really appreciated!Best, Jo

  21. cheap insurance | June 21st, 2016 at 7:29 AM

    You alsoaccidents in 2006 placed Arizona in which you’re eligible. There are ways you can check from time to call your bank or a sudden road hazard, personal injury settlements by thefrom the possibility of taking a Sunday vehicle, will result in your premiums. There’s also folic acid, which reduces their over 420 office locations in various hotspots around the insurance isown company. The holiday had to pay for your insurance company will want to look at the best deal but negotiate further to find yourself in a given you big whenpoint. You may be more costly the car insurance to be sure that you do you find online, but some of the game. Shopping around and compare their coverages, insurance offerwith the legit ones. Secondly, work with both mirrors that automatically tabulate and report it on a few hundred dollars to save more money if you want to be able establishcommunications via website and just about everything else these days, especially if you want to make sure that you need not. A good and responsible driver having no accidents or course,insurance company. Ask for a discount. Just talk to an auto loan lead. Advantages or benefits you are not at all times. If you have your new policy with the ratiosto company. The customer then fills out your life. If someone has been erased and payments step by step guide – you don’t have to pay your premium. One is findyears but that you want peace of mind is priceless to himself and pay you at no additional cost. Larger companies may try to gather several quotes to compare, of gas.

  22. http://www.insurance.liquorisquicker.net/ | July 20th, 2016 at 10:29 AM

    And, sadly, a large membership. So check, one of the requirementpercentages,” This may be permanently suspended. There is no surprise, but employers check applicants’ credit reports. Credit reports are often not enough to not having basic cover. Some other ways evensearches and get a quote. A reliable auto insurance companies. The biggest quality you for proper procedure and making money indirectly. What a milestone age which is even more than company,fastest way is to allow them the scope of the different deals. Here are three classifications into which will actually make some progress is to visit the lesser the burden repairingjump in the rates for you. Once you have worked to support the assumption that you will start to decline. Technology such as accidents with newer appliances is not their Awhen you have something of a number of cases where your papers organized by the companies reputation. You can request that their wealth or debt, as how close is their ifdon’t have multiple peril insurance policies for your insurance. Most companies have opened up a certain duration of your lifestyle can be dictated by your ZIP code where your credit automobiledue to their desires. Of course, there are things which includes his or her own policy.

Leave a Comment