GameHost綜合論壇

標題: 【FB登入】PhoneGap (Cordova) FB登入教學 [打印本頁]

作者: admin    時間: 2016-12-11 23:14
標題: 【FB登入】PhoneGap (Cordova) FB登入教學
第一步:先新增一個 Facebook API 的 專案 選擇 Andoroid 專案
連結: https://developers.facebook.com/

第二步:取得雜湊函數
1. 打開 cmd 輸入
keytool -exportcert -alias androiddebugkey -keystore C:\\Users\你的使用者名稱\.android\debug.keystore | openssl sha1 -binary | openssl base64

(密碼預設為 android )

2.將取得的雜湊與PhoneGap 專案名稱填入【設定】中
[attach]121[/attach]


第三步:回到 phoneGap 專案安裝 facebook 元件
cordova plugin add cordova-plugin-facebookconnect-orlando@latest --variable APP_ID=XXXXXXXXX --variable APP_NAME=XXXXXX

[attach]122[/attach]


第四步:使用方式

登入
[attach]123[/attach]
取得個人資料
[attach]124[/attach]
取得帳號token
[attach]125[/attach]
取得登入狀態
[attach]126[/attach]
登出
[attach]127[/attach]
注意:如果登入出現錯誤可能是金鑰雜湊無法 match ,請不要馬上按返回,fb會回傳一串雜湊,請將此雜湊設為API的金鑰雜湊







歡迎光臨 GameHost綜合論壇 (http://www.gamehost.cc/bbs/) Powered by Discuz! X3.2