-
Notifications
You must be signed in to change notification settings - Fork 2
Social integration
Social integration is rather straightforward, and lives in the IAPI. See that wiki page for general-purpose information.
To connect to an account, the client must send the user to a URL of the format
http://[server]/iapi/social/connect?email=[email]&password=[password]&return=[return]
-
server- The API server's URL -
type- The type of social account to connect (currently,fb,twitter,linkedin) -
email- The user's email address -
password- The user's hashed password -
return- The URL the client should be redirected to upon completion of the connection process
Note that this must be a real browser-based redirect, and not an XHR request or something. The user will probably be required to perform some sort of confirmation on a third party site, which means the user will have interact with that site.
Connected accounts add URLs to the associated user object that point to those accounts' public location. Currently, the set of possible accounts are fb, twitter, and linkedin. For example, my connected account can be accessed as follows:
patrick.fb; //'http://www.facebook.com/profile.php?id=100000272300970';
Listings are shared by directing the user to a page on the server. The URL should be as follows:
http://[server]/iapi/social/share?type=[type]&email=[email]&password=[password]&listing=[listing]&return=[return]
-
server- The API server's URL -
type- The type of social media to share on (fbortwitter) -
email- The user's email address -
password- The user's hashed password -
listing- The ID of the listing to share -
return- The URL to return to when finished.
Note that if the user hasn't already linked the relevant social account to their Hipsell account, they'll be automatically directed to do so. As such, similarly to connect, the user must arrive at this endpoint via a browser-based redirect, and that browser may be required to be visible.
If either the attempt to connect fails, or the sharing itself fails, the user will be redirected to the return url with the error GET argument set to a brief description of the error. Otherwise, if all succeeded, they'll be redirected to the return url with the success GET argument set to true.
Sharing a listing should happen via the same process regardless of whether it's happening on a phone or PC. Here's a flow that should work quite nicely for a tablet or phone:
App creates a hidden webview
Then app then listens on URL changes in the webview
To share the listing, the app sets the URL on the webview to the URL described above, using a return URL of done://done
If the webview's URL changes at any time to something other than hipsell.com, the webview is displayed
(This means that if the user is redirected to a Twitter login page, for example, they'll be able to allow Hipsell to do whatever)
When the URL changes to done://done, the webview is destroyed and the error/success message is shown