63

文書化されていない呼び出しを使用せずに、Facebook 資格情報からユーザーを作成したいと考えています。以下の 2 つの既知の理由から、Parse Javascript ライブラリの現在の実装に基づいてそれが可能であるとは思えません。

1.ライブラリの現在の実装は Appcelerator HTTP クライアントをサポートしていないため、すぐに失敗します。この問題に対処するには、既存の Parse Javascript ライブラリの ajax メソッドを拡張してAppcelerator HTTP client.

http://www.clearlyinnovative.com/blog/post/34758524107/parse-appcelerator-titanium-the-easy-way

私が作成したスライド デッキには約 2,000 回のビューがあり、ブログ投稿にもほぼ同じビューがあったので、人々がこれを機能させたいと思っていることは明らかです。

2.ライブラリの現在の実装では、Facebook Javascript ライブラリとの統合が想定されており、そのライブラリは Appcelerator でも機能しません。実際、Appcelerator は Facebook をフレームワークに直接統合しているため、javascript ライブラリは必要ありません。ユーザー アカウントを Facebook にリンクするために必要なすべての情報は、Appcelerator 開発者が既に使い慣れている API 呼び出しを使用して簡単に取得できます。

元の質問は Parse Support フォーラムから削除されたので、より広いコミュニティからの解決策を探しています。

こんにちはアーロン、

ドキュメント化されていない Parse ライブラリーの API を回避策として使用することを他の開発者が促進することは役に立たないため、リストから外すことにしました。Titanium を使用した特定のケースで役立つ可能性があることは理解しています。また、プライベート API を使用することの意味を十分に認識していますが、他のユーザーはその警告を見落とす可能性があります。お分かりできると良いのですが。

Héctor Ramos ソリューション アーキテクト、Parse https://parse.com/help

これは、危険すぎてフォーラムに公開できないコードです。

// setting auth data retrieved from Ti.Facebook login
authData = {
    "facebook" : {
        "id" : Ti.Facebook.uid,
         "access_token" : Ti.Facebook.accessToken,
         "expiration_date" : expDate, // "format: yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"
    }
};

// Either way I resolved the problem, calling _handleSaveResult(true) on the returned user object, 
// I just dont think it should have been as difficult as it was
// attempt to log the user in using the FB information
var user = new Parse.User();
user.save({
    "authData" : authData
}).then(function(_user) {
    // force the user to become current
    _user._handleSaveResult(true); //<-- this is the evil method I called
    if (!_user.existed()) {

        // add additional user information
        var userInfo = {
            "acct_email" : "bryce@xxxxxx.com",
            "acct_fname" : "Bryce",
            "acct_lname" : "Saunders"
        };
        return _user.save(userInfo);
    }
}).then(function(_user) {

    alert('Hooray! Let them use the app now.');

}, function(error) {
    alert(' ERROR: ' + JSON.stringify(error, null, 2));
});

Appcelerator フォーラムに関する質問

http://developer.appcelerator.com/question/152146/facebook-appcelerator-and-parse-integration-need-help

パースフォーラムに関する質問

https://parse.com/questions/how-do-you-integrate-the-parse-javascript-api-with-appcelerator-and-not-use-undocumented-calls

4

1 に答える 1

2

新しいSDKのこの部分かもしれませんが、単に呼び出すことはできません:

Parse.FacebookUtils.logIn({
  "facebook": {
    "id": "user's Facebook id number as a string",
    "access_token": "an authorized Facebook access token for the user",
    "expiration_date": "token expiration date of the format: yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"
   },
   {
      success : function(_user) {},
      error : function(_user, error) {}
   }
};

Javascript ガイドには記載されていませんが、非縮小版のコード Visa vie には記載されています。

@param {String, Object} permissions The permissions required for Facebook
log in.  This is a comma-separated string of permissions.
Alternatively, supply a Facebook authData object as described in our
REST API docs if you want to handle getting facebook auth tokens
yourself.

Github で公開する予定の最新の SDK をサポートするために、元のコードをいくつか更新しました。

この取り組みを先導していただき、誠にありがとうございます。あなたの元の投稿で何時間も節約できました。

于 2013-09-07T16:33:23.620 に答える