OmniAuth facebook/twiitter SSL certificate error

i have used Omniauth for facebook login . I followed this tutorial to integrate facebook login http://net.tutsplus.com/tutorials/ruby/how-to-use-omniauth-to-authenticate-your-users/

I followed all the steps of that tutorial but after authorizing the app and when redirect to /auth/facebook/callback fails with:
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

This error we get because Omniauth/Oauth wasn’t setting the ca_path variable for OpenSSL of their HTTP calls.OpenSSL did not find the root certificate for Facebook’s SSL certificate.As a result we got this error.

We can solve the issue by two ways .

  • One way is we can set SSL certificate path
  • anothe one is ignore the certificaiton verification

Let’s see what will we do if we want to ignore the certification:

  • you can fix this in CBA’s application-config.
  • Add the following line to your file config/omniauth.rb
  • OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE

So now config/omniauth.rb will be look like :


Rails.application.config.middleware.use OmniAuth::Builder do
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
provider :facebook, "apikey", "secretkey"
end

what will we do to set the certification path :

take a look at this link ruby on rails and ssl error

    • sudo port install curl-ca-bundle
    • modify the config/omniauth.rb files
    • set ca_path in the client options
    • Rails.application.config.middleware.use OmniAuth::Builder do :
      facebook, FACEBOOK_KEY, FACEBOOK_SECRET, {:client_options => {:ssl => {:ca_path => "/opt/local/share/curl/curl-ca-bundle.crt"}}}

Hopefully this two ways can be solved the SSL certificate issue.

end

How to set up Zf2 (Zend Framework) in mamp server

Zend framework released their beta 2 version. I just planned to start work with that. Because I have seen lots of interesting features in zend framework . If you want to see more details about features then you may visit (http://framework.zend.com/wiki/display/ZFDEV2/Home)

So I start to create a project with ZF2.0 . But I faced few problem to see the welcome screen . So here I describe how quickly you can set up a zf project .

First let us know the requirement of ZF 2.0

Assumption:

I assume that you have an idea for the following things :

1. how to setup mamp .
2. how to create virtual host .

Requirement :

1. Php 5.3

Download :

https://github.com/zendframework/zf2

Setup on MAMP:

I just want to show how to set up on mamp . I assume that you already set up

1. Now open your php.ini file located under

/Applications/MAMP/conf/php5/php.ini

2. Search for include_path and add the location of your zend framework:

include_path = ".:/usr/lib/php:/usr/local/lib/php:/Applications/MAMP/path of zendframework/ "

or you can include library/zend while you create a project . I will show in later while we create a project.

3. Zend Framework also comes with a shell script that will help you with RAD (Rapid Application Deployment), you can create a shortcut to Zend Tools in terminal by adding an alias to your profile under /etc/profile and make sure to restart terminal after you’ve done so:

alias zf2=/Applications/MAMP/svn/zendframework/trunk/bin/zf.sh

4. Test if the Zend Tool is installed correctly by showing the version:

zf2 show version

5. Finally navigate to the directory you’d like to create your first project in:

zf2 create project quickstart

And then I create a virtual hosts for local.quickstart.com and when I browse that i have seen a blank page . Then I try to find the error . so I open the php error file by this command : tail –f php_error.log

In that file I have seen lots of error message where most of the error messages are that files are not found.

So I have checked the files. I open a file controllers/indexController.php file . There I find nothing has been written . Same things happened for error Controller . So I have looked at the:
https://github.com/micrub/zf2-bootstrap

. And there I found that how to extend the controller and also how to extend the class. So now again browse the local.quickstart.com and now I have seen it works for me .

Set Up a Local Facebook Development Environment with Virtual Host .

To create a facebook application  http://www.londatiga.net/it/how-to-create-facebook-application-with-php-for-beginner/ , you need a real domain for Canvas URL. For that reasons  I have faced a real trouble to develop Facebook application . I have to change the code on the local machine, uploading them to the server, testing it out in a browser and repeating the process until finish the application. So Even a little change i have to do all  above the process . So i am  looking  for the best way to set up facebook development Environment in local to avoid all irritating process  .And finally i found out of box solution at the leevio . Here i describe the out of box solution  .

Create Only  Virtual Host :

1. Just only  create a virtual host in the localmachine according to you canvas domain name.That’s it nothing need to do more . It will save all of your effort and time   Like you set canvas url “myfbapps” .

Here is the instruction to create a virtual hosts at ubuntu . But you can create virtual host for any os

1. Open a new file and write down the server configuration

Server configuration:

<VirtualHost *:80>
DocumentRoot /www/ myfbapps
ServerName local.myfbapps.com

# Other directives here

</VirtualHost>

2. Then save the file to /etc/apache2/sites-available. Give it a name like myfbapps

3. And then edit the file hosts under etc directory : /etc/hosts
4 . Open terminal and type the following command or copy and paste it.
sudo a2ensite smronju //change smronju to your file name.
5. Now you have restart your apache server the following command.
sudo /etc/init.d/apache2 restart

Few more reference link :
http://www.facebook.com/note.php?note_id=382450211283

Facebook IFRAME Application Issues : PART-1

While I switch one of my fb application  from FBML to iframe , I have faced some silly problem. But to solve those problems , I have to waste so many hours. After searching the forum, asking mates and friends and then find out the solution.  I am thinking Mahedi hasan to help me a lot. When I got the solution I found that it’s a very 1 or 2 min jobs.   I have found mostly these problem arise in the beginning of application and basic issues. I hope so you will share your iframe problem too .

Here are the problems that I have faced  while developing an iframe application:

1. POST Submission problem :

http://forum.developers.facebook.com/viewtopic.php?id=24430

While I submit the post data unfortunately I  do not get any post data. I have found that post field is empty. I am very surprised how my $_POST field is empty though it submit the action page.   I have given a sample form of my application.

Posting it via the server url:


<form action="http://myserver.com/appname" method="POST">
<input type="text" name="test1"></input>
<input type="submit" name="Submit"/>
</form>


Posting it via the app callback url:



<form action="http://app.facebook.com/appname" method="POST">
<input type="text" name="test1"></input>
<input type="submit" name="Submit"/>
</form>


After search in  facebook developer wiki,forum and blog , I have known that

while submit the form , iframe lost the session key as there is no session key passed . As a result it lost user id and lost all the post data. That’s why i have to set user_id. So below is the forum post link :

http://forum.developers.facebook.com/viewtopic.php?id=22929

And  here Is how I solve this issue . This my modified form where I added two  hidden fields. One is fb_sig_session_key and another one is user_id.

Posting via fb_sig_session_key and user_id

<form action="http://myserver.com/appname" method="POST">
<input type="text" name="test1"></input>
<input type="hidden" name="fb_sig_session_key" value=”<?php $_GET[‘fb_sig_session_key’]”></input>
<input type="hidden" name="user_id" value=”<?php $_GET[‘user_id’]”></input>
<input type="submit" name="Submit"/>
</form>

So after submit the form here I show how can I set_user and now find the post values.

</pre>
<?php

if (isset ( $_REQUEST ['kb_fb_sig_session_key'] )) {

$this->fb_sig_session_key = $_REQUEST ['fb_sig_session_key'];

}

if (isset ( $_REQUEST ['user_id'] )) {

$this->uid = $_REQUEST ['user_id'];

}

if ($this->uid != '') {

$this->facebook->set_user ($this->uid, $this->kb_fb_sig_session_key );

}

$this->facebook->set_user ($this->uid, $this->fb_sig_session_key );

?>

2 . Application  Link  problem :

While I click on any link in my iframe application , I have found that it reloads the whole facebook page again in the iframe canvas. I just use this type of code and found the problem load  .

<a href=”http://apps.facebook.com/MyApp/invite.php”>Invite</a&gt;

I found the solution in this thread : http://forum.developers.facebook.com/viewtopic.php?pid=208220

Only add the taget=”__top” into the anchor.

So I add target=”_top”. <a href=”http://apps.facebook.com/MyApp/invite.php”>Invite</a&gt;.   And now it work.

3.iframe size problem  :

I have faced problem to resize my frame application. Initially when page load the frame size is correct. But when I show the facebook profile photo of users , then find that it does not resize. I do not see the footer and it cut down. We have solve this problem by adding  javascript setTimer to resize the height. You have seen similar type problem here : http://forum.developers.facebook.com/viewtopic.php?pid=17541#p17541

4.  Setting issues :

I think to set up my application as an iframe application, I do not need to set up the connect url. But when I do not set up connect url I see blank page. So when I set up the call back url , I have found that my application working.

I think to set up my application as an iframe application, I do not need to set up the connect url. But when I do not set up connect url I see blank page. So when I set up the call back url , I have found that my application working.

I have few more issues and will be add next topics.

Mooving my Carrier further

I am leaving the informatix software. Today is the last day of informatix software. I have passed a very wornderful moment at informatix. In the informatix I have spend my time like a family member. I got lots of help from the mizan bhai, Ehsan bhai,yunus bhai , khabir bhai , shojib bhai and sumon bhai. And passing a very memorable moment with them.  I am very much thankful to  all of them for their friendly behavior.

From the december i will join at the blueliner bangladesh team as a Senior software engineer. I am requestiing all of you to pray for me.

My new DELL XPS M1640

Finally i have gotten my new DELL Studio XPS 1620. I have been waiting for buying a laoptop so many days. And Mizan bhai help me to bring this laptop from USA. This laptop has been bought by from ebay. After 1 week waiting i have gotten my laptop.

The awsome design dell xps will forget you everything.It has Premium design with genuine leather accents, anodized aluminum, edge-to-edge display and backlit keyboard. The leater acents make it very unique desing and make it very luxarious goods. And the backlit keyborad make you always typing in the key board . Now i can even work in the dark night . So my roommate are happy to switch off the light while sleeping. And the 16”” with edge to edge display is very interesting.

Here is the features of My New Dell XPS M1640 Studio XPS 16 Intel® Core™ 2 Duo P7350 (3MB cache/2.0GHz/1066Mhz FSB) Genuine Windows Vista® Home Premium Edition SP1, 64-bit LCD Panel Edge-to-Edge HD Widescreen 16.0 inch WLED LCD (1366×768) W/2.0 MP MEMORY 3GB2 DDR3 SDRAM3 at 1067MHz (2 Dimms) Hard Drive 320GB5 7200 RPM6 SATA Hard Drive Battery Options 6-cell Batterydell-xps-13-16-1

Awesome PHPXperts Seminar 2009.. Overview OpenSource Ecommerce Application – Magento

Recently an Awesome PHPXperts Seminar,2009  had been held at BRAC University , Dhaka .PHPXperts is one of the largest community in Bangladesh. At that seminar lot of programmers were present under a roof. And the presentation topic was the “Current development trends.” And I have an opportunity to speech on that seminar. Thanks Hasin bhai and other moderators to give this opportunity.

I am sharing my present slide at slide share.

http://www.slideshare.net/bijon/open-source-ecomm-php

In my presentation, my intension is to know the basic ecommerce features and the tools to make an ecommerce solution. For the tools I have described the mostly popular and idely used 4 open source solutions.

They are oscomemrce, zencart, virtumart and magento. And share with little with all the features ,pros and corns of those ecommerce . And finally I have give the idea about current ecommerce application trends  which is magento .

After that presentation I found that lots of peoples are interested about the ecommerce solution. And I just want to say that I am very sorry for those who raise hands but they do not get the chance to ask questions. Because of our shortage of time. But I will be glad if you contact with me to know anything or  any suggestion  .:)

Follow

Get every new post delivered to your Inbox.