Coming soon : Tank Auth with Twitter oAuth Authentication (continuing with XTA)

My first GitHub project saw the XTA project going live. I was quite happy to release it and be able to receive quite a few positive feedback on it on CodeIgniter forum. So I think it’s now time to move on to plugging in Twitter oAuth authentication mechanism on top of this. For this, I will be using Elliot Haughin’s Twitter library. I’ll try to update this post within a few days!

Force logout on Elliot Haughin’s Twitter plugin

I use Elliot Haughin’s CodeIgniter + Twitter authentication plug-in often and it’s a great library. Recently, I wanted to make sure that I was logging users out properly. After a little bit of searching, I modified Elliot’s code ever so slightly to ensure that users log out and press “allow” or “deny” on their Twitter account page, before accessing the website.

In Twitter.php file, look for the line that has the following line

return $this->authorizeUrl . ‘?oauth_token=’ . $token->oauth_token;

We can simply edit this to

return $this->authorizeUrl . ‘?oauth_token=’ . $token->oauth_token . ‘&force_login=true’;

To ensure that users always authenticate to their Twitter account before accessing. I’ll try to integrate this to my XTA project soon!

XTA – Extending Tank Auth with 3rd Party Authentication (e.g. Facebook Connect for now)

A few days ago, I decided to post up my first GitHub project. How lazy of me to take this long to post it up. Anyway, I wanted to share a basic CodeIgniter project that integrates Tank Auth with Facebook Connect authentication. I’m quite sure there would be other people who have done similar things, but last time I checked the CI forum, there doesn’t seem to be a downloadable plug-in for this.

Well, I have finished up the v0.1 and it is now available for all to see at GitHub project page. For now, Tank Auth is integrated with Facebook only. So you can either choose to register via Tank Auth or Facebook. I’ll try to update it with Twitter soon.

Modify Tank Auth Captcha feature

I use Tank Auth a lot for my CodeIgniter development work. It’s nice & flexible and since I’ve used it a number of times, I’m much more familiar with it now than before. One of the nice features of this tool is that it comes with the CAPTCHA feature. However, the default settings for Tank Auth captcha sometimes renders the image in such a way that is hard to read for users. So it is always good if you can modify it (e.g. change the colours, option of using numbers, small or capital letters).

Such modification can be made in captcha_helper.php file. Look for this file and then go all the way down to around line 111 and 150. In line 111, I changed it to following

$pool = ‘ABCDEFGHIJKLMNOPQRSTUVWXYZ’;

Because sometimes numbers and letters are hard to differentiate. On line 150, I changed the colours involved in CAPTCHA image.

$bg_color        = imagecolorallocate ($im, 240, 240, 240);
$border_color    = imagecolorallocate ($im, 210, 210, 213);
$text_color        = imagecolorallocate ($im, 134, 156, 178);
$grid_color        = imagecolorallocate($im, 179, 207, 235);
$shadow_color    = imagecolorallocate($im, 255, 240, 240);

Now the letters in the images are clearer and easier to recognize for users.