Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ShareKit LinkedIn integration, first version (github release) #271

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jspoto
Copy link

@jspoto jspoto commented Jul 14, 2011

I've integrated LinkedIn sharing, using the published REST API (authenticating via OAuth) into ShareKit. Below is a copy of my initial commit notes, from SHKLinkedIn.m.

To summarize: Sharing works, and I've included a new class cluster for dynamic, multi-line field input. Please feel free to take whatever you'd like, and also feel free to test and provide pull req's for updates.

I did see a couple of issues in the context of the Example application - one memory leak, and some issues re-authenticating with Twitter periodically. Please see below (or SHKLinkedIn.m) for more info.

The push is to use this (or some variant) of SHKit in "shipping" software, so any help is appreciated. Reviews, ideas, and general feedback is very much welcome.

Details and notes to follow...

@jspoto
Copy link
Author

jspoto commented Jul 14, 2011

/* SHKLinkedIn (7/11/2011) Jim Spoto

Some notes on getting this service up and running...

Reference Code: http://lee.hdgreetings.com/2011/03/iphone-oauth.html

    * The project linked above has a working implementation of OAuth via LinkedIn, and was used
    primarily as a point of reference.  It appears to have a different flavor of OAuth which,
    frustratingly, couldn't be integrated directly into ShareKit without what appeared to be
    a substantial amount of work.


OAuth: OAMutableURLRequest modified to enable authorization via LinkedIn

    * Modifications/additions to better support realm / callback in the request
    * An appropriate callback & verifier is necessary to avoid LinkedIn's OOB (pin) validation path
    * Both the header and signature have to be created and assembled correctly.  Some parameters
    seem to require being in both, some not.  Perhaps the OAuth spec can be reviewed to validate
    this (http://oauth.net/core/1.0/)


UI: A new style UI class cluster has been created, based largely on the SHKTwitter source

    * The class cluster includes classes for form, form style, abstract field, and three specific
    field types: text, URL, and multiline text

    * Discussion:  The reason for going this route was the apparent incompatibility between the
    way custom ShareKit forms are designed to work, and the way the SHKTwitter form works, in terms
    of available UI functionality and composition of controls.  LinkedIn includes support for very
    long (700 characters) input fields, and UITextField controls are not usable for long input.  The
    SHKTwitter style control is, but does not support multiple multi-line input fields - something
    again supported by LinkedIn share data.  

    * Features: The UI classes support custom coloring via the style property of the form class, and
    new field classes should be fairly simple to add by extending the SHKLinkedInForm class.

    * Implementation: The form is created using a custom UIScrollView class instead of a UITableView.
    the primary reasons for this are the issues associated with embedding UITextView controls inside of
    a UITableViewCell object.  It may be desirable to rework SHK form code, to support dynamically
    sized, multi-line cell classes, but there were enough caveats to avoid this on a first pass.

    For what it's worth, AddressBook appears to do this somehow, so it's possible (if you're Apple)...

    * "SHK Native UI:  If this is desired, moving the core share functionality of SHKLinkedIn.m into
    a vanilla custom share class should be straightforward


Categories:  Created to experiment with some class methods, without modifying them

    SHKItem+KVC: Facilitates KVC methods on the Item, instead of using the methods to conver to an
    NSDictionary, which would seem unnecessary (and acutally only supports string parms).  Making
    getting/setting item data more dynamic greatly improved the ease with which fields (and their
    associated keys) can automatically sync with the share Item.

    UIWebView+SHKPlus:  A bit of a toy, really.  Javascript to get the Document meta tag from a web
    page.  Many social networking sites do something like this automatically when posting a link, and
    since LinkedIn supports a link description, I used this data to auto-fill the Description field
    by adding support in ExampleShareLink.m



TDB / Incomplete Features:  The important stuff I haven't yet gotten to..   

    Error Handling, Login/Auth Failure Handling is *incomplete*!  Currently, virtually no error handling
    exists based on LinkedIn's return data.  Need to include authorization issues (and reauthentication loop)
    as well as share/api return errors.


Known Issues / Bugs:

    * Twitter: Using the Example project, having issues when attempting to re-login after logging out with Twitter.
    Not sure if the unmodified project has this issue (need to test).  May have broken something with Twitter when
    getting LinkedIn working (JRS)

    * Memory Leak:  Occaisional leak sharing with LinkedIn using the Example project, when doing the following:
    Authenticate, cancel out of share form, log out, authenticate again, cancel during share step, etc.  At a glance,
    the leak does not appear to be coming from any of the SHK classes directly (and may be in another thread related
    to the URL connection).  Need to test and compare to the unmodified (ie non-LinkedIn) project (JRS)


Reference:  

    * Information on the LinkedIn API & OAuth

LinkedIn Rest Doc. Home: http://developer.linkedin.com/community/apis
              Share API: http://developer.linkedin.com/docs/DOC-1212#
        Throttle Limits: http://developer.linkedin.com/docs/DOC-1112
          Common Issues: http://developer.linkedin.com/docs/DOC-1121

@jspoto
Copy link
Author

jspoto commented Jul 14, 2011

@quazarteam: Try moving this discussion to here: https://github.com/jspoto/ShareKit/issues

If I have time, I will attempt to help, but please note, this issue is specific to your use case outside of git, and integration with the ShareKit project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant