Twtrubiks Flask Login Example Save

Login register facebook Login - Python Flask

Project README

Flask-Login-example

Login register facebook Login - Python Flask

常看到別人的網站有登入、註冊、使用FACEBOOK登入,今天教你使用 Python Flask 建立一個。

使用 Python Flask 搭配 Flask-Login 實現登入機制,也透過 Facebook API完成常見的使用Facebook登入。

特色

  • 搭配 Flask-Login 實現登入、註冊機制。
  • 透過 Facebook API 完成常見的使用 Facebook 登入。
  • 資料庫(database)使用 SQLite。

安裝套件 Flask-Login

請先確定電腦有安裝 Python

Flask-Login

pip install flask-login

更多 Flask-Login ,可參考 Flask-Login

使用Facebook登入-前置作業

請先到  facebook-developer,點右上角的 我的應用程式,選 新增應用程式

接著輸入 顯示名稱 以及選擇 類別,如下圖

alt tag

接著頁面會跳到 alt tag

選擇 新增平台,這裡選擇 網站 當作範例 alt tag

輸入 網域,這裡先輸入 localhost alt tag

接下來將你的 應用程式編號 貼到下方

window.fbAsyncInit = function() {
      FB.init({
        appId      : 'your-app-id',
        cookie     : true,  // enable cookies to allow the server to access
                            // the session
        xfbml      : true,  // parse social plugins on this page
        version    : 'v2.8' // use graph api version 2.8
      });
  };

更詳細的請看 Facebook JavaScript SDK,請到 facebook developers

執行畫面

登入頁

alt tag

註冊頁

alt tag

使用Facebook登入 alt tag

執行環境

  • Python 3.4.3

Reference

External JS

Donation

文章都是我自己研究內化後原創,如果有幫助到您,也想鼓勵我的話,歡迎請我喝一杯咖啡:laughing:

alt tag

贊助者付款

License

MIT license

Open Source Agenda is not affiliated with "Twtrubiks Flask Login Example" Project. README Source: twtrubiks/Flask-Login-example
Stars
43
Open Issues
1
Last Commit
6 years ago

Open Source Agenda Badge

Open Source Agenda Rating