定型管 電子鈑金
返回列表 回復 發帖

帖子標題:[分享] 用facebook登入ecshop

看見現在很多地方,只要你有facebook帳戶的都可以用facebook直接登入而又可以不用註冊
大陸那邊問過了,因為他們都用不到facebook的,所以那邊的高手也不可能開發的了
我想都只可以我們這邊自行開發的了

那麼多網站都有這個功能,FB一定本身已經有這個程式碼發了出來的
但找了很欠都找不到...介紹的也只是說明FB的程式碼如何用...
本人已經試了很久...因不太會用FB的程式碼,最後都是失敗了

希望大家都頂一下,也希望有高手可以分享一下
提醒您: 您在"ECSHOP 交流討論區"交流請遵守台灣法律規範,"spiritwing" 發表的文章《用facebook登入ecshop》版權歸屬作者所有,如是轉貼版權歸屬原作者所有.本論壇不對其真實性做任何考證.
本帖最後由 spiritwing 於 2011-1-13 16:48 編輯

Facebook helps you simplify and enhance user registration and sign-in by using Facebook as your login system. Users no longer need to fill in yet another registration form or remember another username and password to use your site. As long as the user is signed into Facebook, they are automatically signed into your site as well. Using Facebook for login provides you with all the information you need to create a social, personalized experience from the moment the user visits your site in their browser.

Facebook Platform uses OAuth 2.0 for authorization and authorization. While you can add login to your site using OAuth 2.0 directly (see our Login Overview), the open source JavaScript SDK is the simplest way to use Facebook for Login.

The JavaScript SDK requires that you register your website with Facebook to get an Application ID (or appId). The appId is a unique identifier for your site that ensures that we have the right level of security in place between the user and your website. The following example shows how to load the JavaScript SDK once you have your appId:
  1. <html>
  2.     <head>
  3.       <title>My Facebook Login Page</title>
  4.     </head>
  5.     <body>
  6.       <div id="fb-root"></div>
  7.       <script src="http://connect.facebook.net/en_US/all.js"></script>
  8.       <script>
  9.          FB.init({
  10.             appId:'YOUR_APP_ID', cookie:true,
  11.             status:true, xfbml:true
  12.          });
  13.       </script>
  14.     </body>
  15. </html>
複製代碼
Once you have loaded the JavaScript SDK into your page and initialized it with your appId, you simply add the Login Button to your page using the <fb:login-button> XFBML element as shown below:
  1. <html>
  2.     <head>
  3.       <title>My Facebook Login Page</title>
  4.     </head>
  5.     <body>
  6.       <div id="fb-root"></div>
  7.       <script src="http://connect.facebook.net/en_US/all.js"></script>
  8.       <script>
  9.          FB.init({
  10.             appId:'YOUR_APP_ID', cookie:true,
  11.             status:true, xfbml:true
  12.          });
  13.       </script>
  14.       <fb:login-button>Login with Facebook</fb:login-button>
  15.     </body>
  16. </html>
複製代碼
When the user loads the page in their browser, the JavaScript SDK renders the Login Button on your page:



In order to log the user into your site, three things need to happen. First, Facebook needs to authenticate the user. This ensures that the user is who they say they are. Second, Facebook needs to authenticate your website. This ensures that the user is giving their information to your site and not someone else. Lastly, the user must explicitly authorize your website to access their information. This ensures that the user knows exactly what data they are disclosing to your site.

These steps may seem complex, but fortunately all you need to do is use the fb:login-button and all the user needs to do is click it. When the user does so, the JavaScript SDK will ensure that the user is signed into Facebook and that the request is coming from your website. We then present an authorization dialog in their browser that provides information about your site and the user data you are requesting. By default, this dialog looks like the below:



If the user clicks Allow, we will give your site access to the requested information. If the user clicks, Don't Allow the dialog will close and no information will be available to your website. By default, we give you access to the user's name, picture and any other data they have shared with everyone on Facebook (see the User Graph object for more details).

If you need access to more information, such as the user's email address, etc. you must request permissi** for this information. If you can do this by adding the permissi** you need to the perms attribute of the fb:login-button like below:
  1. <html>
  2.     <head>
  3.       <title>My Facebook Login Page</title>
  4.     </head>
  5.     <body>
  6.       <div id="fb-root"></div>
  7.       <script src="http://connect.facebook.net/en_US/all.js">
  8.       </script>
  9.       <script>
  10.          FB.init({
  11.             appId:'YOUR_APP_ID', cookie:true,
  12.             status:true, xfbml:true
  13.          });
  14.       </script>
  15.       <fb:login-button perms="email,user_checkins">
  16.          Login with Facebook
  17.       </fb:login-button>
  18.     </body>
  19. </html>
複製代碼
When the user clicks the login button from this page, they will see the below authorization dialog. Note that there are now two new secti** that outline the additional information that your site is requesting permission to access.



A full list of permissi** is available in our permissi** guide. There is a strong inverse correlation between the number of permissi** your site requests and the number of users that will allow those permissi**. The greater the number of permissi** you ask for, the lower the number of users that will grant them; so we recommend that you only request the permissi** you absolutely need for your site.

In addition to Login Button, we offer the Registration Plugin. The Registration Plugin offers two key features not available with the Login Button: support for users without Facebook accounts and the ability to request additional user information that Facebook may not have or make available.

Using the Registration Plugin is just as simple as using the Login Button. You merely need to use the fb:registration XFBML element in your page, rather than the Login Button:
  1. <html>
  2.     <head>
  3.       <title>My Facebook Registration Page</title>
  4.     </head>
  5.     <body>
  6.       <div id="fb-root"></div>
  7.       <script src="http://connect.facebook.net/en_US/all.js">
  8.       </script>
  9.       <script>
  10.          FB.init({
  11.             appId:'YOUR_APP_ID', cookie:true,
  12.             status:true, xfbml:true
  13.          });
  14.       </script>
  15.          <fb:registration
  16.             fields="[{'name':'name'}, {'name':'email'},
  17.             {'name':'favorite_car','description':'What is your favorite car?',
  18.             'type':'text'}]" redirect-uri="URL_TO_LOAD_AFTER_REGISTRATION">
  19.     </fb:registration>
  20.     </body>
  21. </html>
複製代碼
Facebook helps you simplify and enhance user registration and sign-in by using Facebook as your login system. Users no longer need to fill in yet another registration form or remember another username and password to use your site. As long as the user is signed into Facebook, they are automatically signed into your site as well. Using Facebook for login provides you with all the information you need to create a social, personalized experience from the moment the user visits your site in their browser.

Facebook Platform uses OAuth 2.0 for authorization and authorization. While you can add login to your site using OAuth 2.0 directly (see our Login Overview), the open source JavaScript SDK is the simplest way to use Facebook for Login.

The JavaScript SDK requires that you register your website with Facebook to get an Application ID (or appId). The appId is a unique identifier for your site that ensures that we have the right level of security in place between the user and your website. The following example shows how to load the JavaScript SDK once you have your appId:
  1. <html>

  2.     <head>

  3.       <title>My Facebook Login Page</title>

  4.     </head>

  5.     <body>

  6.       <div id="fb-root"></div>

  7.       <script src="http://connect.facebook.net/en_US/all.js"></script>

  8.       <script>

  9.          FB.init({

  10.             appId:'YOUR_APP_ID', cookie:true,

  11.             status:true, xfbml:true

  12.          });

  13.       </script>

  14.     </body>

  15. </html>
複製代碼
Once you have loaded the JavaScript SDK into your page and initialized it with your appId, you simply add the Login Button to your page using the <fb:login-button> XFBML element as shown below:
  1. <html>

  2.     <head>

  3.       <title>My Facebook Login Page</title>

  4.     </head>

  5.     <body>

  6.       <div id="fb-root"></div>

  7.       <script src="http://connect.facebook.net/en_US/all.js"></script>

  8.       <script>

  9.          FB.init({

  10.             appId:'YOUR_APP_ID', cookie:true,

  11.             status:true, xfbml:true

  12.          });

  13.       </script>

  14.       <fb:login-button>Login with Facebook</fb:login-button>

  15.     </body>

  16. </html>
複製代碼
When the user loads the page in their browser, the JavaScript SDK renders the Login Button on your page:



In order to log the user into your site, three things need to happen. First, Facebook needs to authenticate the user. This ensures that the user is who they say they are. Second, Facebook needs to authenticate your website. This ensures that the user is giving their information to your site and not someone else. Lastly, the user must explicitly authorize your website to access their information. This ensures that the user knows exactly what data they are disclosing to your site.

These steps may seem complex, but fortunately all you need to do is use the fb:login-button and all the user needs to do is click it. When the user does so, the JavaScript SDK will ensure that the user is signed into Facebook and that the request is coming from your website. We then present an authorization dialog in their browser that provides information about your site and the user data you are requesting. By default, this dialog looks like the below:



If the user clicks Allow, we will give your site access to the requested information. If the user clicks, Don't Allow the dialog will close and no information will be available to your website. By default, we give you access to the user's name, picture and any other data they have shared with everyone on Facebook (see the User Graph object for more details).

If you need access to more information, such as the user's email address, etc. you must request permissi** for this information. If you can do this by adding the permissi** you need to the perms attribute of the fb:login-button like below:
  1. <html>

  2.     <head>

  3.       <title>My Facebook Login Page</title>

  4.     </head>

  5.     <body>

  6.       <div id="fb-root"></div>

  7.       <script src="http://connect.facebook.net/en_US/all.js">

  8.       </script>

  9.       <script>

  10.          FB.init({

  11.             appId:'YOUR_APP_ID', cookie:true,

  12.             status:true, xfbml:true

  13.          });

  14.       </script>

  15.       <fb:login-button perms="email,user_checkins">

  16.          Login with Facebook

  17.       </fb:login-button>

  18.     </body>

  19. </html>
複製代碼
When the user clicks the login button from this page, they will see the below authorization dialog. Note that there are now two new secti** that outline the additional information that your site is requesting permission to access.



A full list of permissi** is available in our permissi** guide. There is a strong inverse correlation between the number of permissi** your site requests and the number of users that will allow those permissi**. The greater the number of permissi** you ask for, the lower the number of users that will grant them; so we recommend that you only request the permissi** you absolutely need for your site.

In addition to Login Button, we offer the Registration Plugin. The Registration Plugin offers two key features not available with the Login Button: support for users without Facebook accounts and the ability to request additional user information that Facebook may not have or make available.

Using the Registration Plugin is just as simple as using the Login Button. You merely need to use the fb:registration XFBML element in your page, rather than the Login Button:
  1. <html>

  2.     <head>

  3.       <title>My Facebook Registration Page</title>

  4.     </head>

  5.     <body>

  6.       <div id="fb-root"></div>

  7.       <script src="http://connect.facebook.net/en_US/all.js">

  8.       </script>

  9.       <script>

  10.          FB.init({

  11.             appId:'YOUR_APP_ID', cookie:true,

  12.             status:true, xfbml:true

  13.          });

  14.       </script>

  15.          <fb:registration

  16.             fields="[{'name':'name'}, {'name':'email'},

  17.             {'name':'favorite_car','description':'What is your favorite car?',

  18.             'type':'text'}]" redirect-uri="URL_TO_LOAD_AFTER_REGISTRATION">

  19.     </fb:registration>

  20.     </body>

  21. </html>
複製代碼
If the user is not already logged into Facebook, they will see the below form. Notice that the form is not prefilled with any user information, but there is a link to login to Facebook to do so.



If the user is already logged into Facebook or decides to login from the registration form, they will see the below. Notice that the form is now prefilled with their Facebook information.



Once the user reviews the information and/or enters any custom fields (in the above example, favorite_car is a custom field that the user must populate directly, as it is not data that is currently part of the user's Facebook profile), the user clicks Register. This will start the authentication and authorization process which is denoted by the below dialog:



With authentication/authorization complete, we redirect the user to whatever URL you placed into the redirect-uri attribute of the fb:registration element which completes the registration process.

The Login Button and the Registration Plugin allow you to easily bring the more than 500 million Facebook users to your site. In doing so, you can also eliminate or reduce whole parts of your codebase. You can learn more about how to add Login with Facebook to your site by reading the documentation for the Login Button, the Registration Plugin and the JavaScript SDK.
提醒您: 您在"ECSHOP 交流討論區"交流請遵守台灣法律規範,"spiritwing" 發表的文章《》版權歸屬作者所有,如是轉貼版權歸屬原作者所有.本論壇不對其真實性做任何考證.
這位大哥,事情不是您想像的那麼簡單的!
光是前台的login page是不夠的,後台資料庫的user欄位要去對應,足以讓人一個頭兩三個大!
目前,把頁面代網址及內容帶到FB已可行
但是,後端要修改,恐怕不會那麼簡單的!!
提醒您: 您在"ECSHOP 交流討論區"交流請遵守台灣法律規範,"hivenus" 發表的文章《》版權歸屬作者所有,如是轉貼版權歸屬原作者所有.本論壇不對其真實性做任何考證.
伸手摘星 至少不會滿手污泥
是不簡單的,
所以希望有高人可以搞到吧

我想問一下你是如何把內容帶到FB的
我現在是用ping.fm把feed.php放上去,
但不是每一次都把商品 放對的,有時是把放到購物車的圖顯示了出來的
可以教一下我有其他方法嗎?
提醒您: 您在"ECSHOP 交流討論區"交流請遵守台灣法律規範,"spiritwing" 發表的文章《》版權歸屬作者所有,如是轉貼版權歸屬原作者所有.本論壇不對其真實性做任何考證.
這位老哥,千萬請別跟我說您沒有爬過文

方法一.請參考這篇:
http://ecshop.tw/bbs/thread-1405-1-2.html

方法二.google一下addthis
它比較簡單,但是觀看它的語法,需借重與它的連結
提醒您: 您在"ECSHOP 交流討論區"交流請遵守台灣法律規範,"hivenus" 發表的文章《》版權歸屬作者所有,如是轉貼版權歸屬原作者所有.本論壇不對其真實性做任何考證.
伸手摘星 至少不會滿手污泥
這位老哥,千萬請別跟我說您沒有爬過文

方法一.請參考這篇:
http://ecshop.tw/bbs/thread-1405-1-2.html

方法二.google一下addthis
它比較簡單,但是觀看它的語法,需借重與它的連結 ...
hivenus 發表於 2011-1-15 12:58
人家說的是登入,不是分享
提醒您: 您在"ECSHOP 交流討論區"交流請遵守台灣法律規範,"spiritwing" 發表的文章《》版權歸屬作者所有,如是轉貼版權歸屬原作者所有.本論壇不對其真實性做任何考證.
人家說的是登入,不是分享
spiritwing 發表於 2011-2-13 23:08
所以我寫得不夠清楚?
>>目前,把頁面代網址及內容帶到FB已可行
>>但是,後端要修改,恐怕不會那麼簡單的!!

還是你補述的口氣
>>人家說的是登入,不是分享
讓我覺得你有些不耐煩???
提醒您: 您在"ECSHOP 交流討論區"交流請遵守台灣法律規範,"hivenus" 發表的文章《》版權歸屬作者所有,如是轉貼版權歸屬原作者所有.本論壇不對其真實性做任何考證.
伸手摘星 至少不會滿手污泥
本帖最後由 spiritwing 於 2011-3-14 12:42 編輯

提醒您: 您在"ECSHOP 交流討論區"交流請遵守台灣法律規範,"spiritwing" 發表的文章《》版權歸屬作者所有,如是轉貼版權歸屬原作者所有.本論壇不對其真實性做任何考證.
提醒您: 您在"ECSHOP 交流討論區"交流請遵守台灣法律規範,"vestamk" 發表的文章《》版權歸屬作者所有,如是轉貼版權歸屬原作者所有.本論壇不對其真實性做任何考證.
樓上的大大,請教一下是如何製作的?可分享嗎?
提醒您: 您在"ECSHOP 交流討論區"交流請遵守台灣法律規範,"winnyyeung" 發表的文章《》版權歸屬作者所有,如是轉貼版權歸屬原作者所有.本論壇不對其真實性做任何考證.
請問一下 各位 我的是2.5版本的~~怎麼分享到FACEBOOK....那個縮圖好像~~不能被正確的分享出來
提醒您: 您在"ECSHOP 交流討論區"交流請遵守台灣法律規範,"藍色珊瑚" 發表的文章《》版權歸屬作者所有,如是轉貼版權歸屬原作者所有.本論壇不對其真實性做任何考證.
9# vestamk


請問這是怎麼做到的?
提醒您: 您在"ECSHOP 交流討論區"交流請遵守台灣法律規範,"hsu1129" 發表的文章《》版權歸屬作者所有,如是轉貼版權歸屬原作者所有.本論壇不對其真實性做任何考證.
http://www.groupinstyle.com.tw/shop/user.php

是這個嗎??
vestamk 發表於 2011-4-29 15:41
便是這個東西了
提醒您: 您在"ECSHOP 交流討論區"交流請遵守台灣法律規範,"spiritwing" 發表的文章《》版權歸屬作者所有,如是轉貼版權歸屬原作者所有.本論壇不對其真實性做任何考證.
对,我也想要这个。。。有人可以分享吗?
提醒您: 您在"ECSHOP 交流討論區"交流請遵守台灣法律規範,"mark21" 發表的文章《》版權歸屬作者所有,如是轉貼版權歸屬原作者所有.本論壇不對其真實性做任何考證.
http://www.groupinstyle.com.tw/shop/user.php
這個站倒了????   

那還是不要亂用fb好了~~~~哈
提醒您: 您在"ECSHOP 交流討論區"交流請遵守台灣法律規範,"chaohsien" 發表的文章《》版權歸屬作者所有,如是轉貼版權歸屬原作者所有.本論壇不對其真實性做任何考證.
返回列表