Using LinkedIn's iOS 9 SDK for authentication with a webview instead of LinkedIn's mobile app

Deadly 提交于 2019-12-20 05:17:28

问题


My iOS app currently offers users the option to log in and sign up with their LinkedIn accounts. I am using this project for the LinkedIn log and OAuth: LinkedInOAuth

With the update to iOS 9, my app now occasionally crashes, when a user attempts to log in through LinkedIn using that project, with a runtime exception of WebThread(18): EXC_BAD_ACCESS(code=1, address=0x8)

To resolve this occasional crash, I turned to an updated version of the project I was using that conforms to ios 9 and linkedin's ios 9 SDK.

The issue is that while this new project has solved the WebThread crashing, it now requires users to download LinkedIn's app (if they don't have it) in order to log in to my app with LinkedIn.

The previous project never had such requirements and would present a webview that allowed anyone with a linkedin account to log in.

My question is am I wondering if it is possible to authenticate with LinkedIn in ios 9 without requiring the user to download the mobile app? My hopes are that it is possible to update the old project to conform to ios 9 while simply presenting a webvew. Thank you!


回答1:


We only discussed this last week (at the time your question didn't have an answer, but happy to update you now—that is, if you haven't solved this in the meantime).

After scouring several sources I came across this:

Mobile vs server-side access tokens

Presently, there is no mechanism available to exchange them. If you require tokens that can be used in both the mobile and server-side environment, you will need to implement a traditional OAuth 2.0 solution within your iOS environment to acquire tokens that can be leveraged in both situations.

from: https://developer.linkedin.com/docs/ios-sdk-auth

The premise being that via mobile solutions, they offer single sign-on thru their app. This works, but requires their app. Apple's approval process has swung both ways on this, and it appears that it is a flip of the coin as to whether they will allow this or not (the requirement of a third party app). @AroundThen didn't have any luck and his app was rejected due to the requirement, however, other users* have indicated Apple weren't adverse to it in their application processes.

Alternatively, their is the web logon process using OAuth2. This is pretty stock for their non-mobile solutions. Currently sharing the tokens between mobile and web solutions is not a default and if you want to share the same token their solution is that that is listed above.

In essence (and copied from my other answer here):

You can test for the presence of the linked-in app:

  • if it is not there: implement OAuth2 directly through your app
  • if it is there: use it or your OAuth2 implementation (which you'd probably err on the side of using their app for the link-ability between any features of the app you may need in yours).

Thereby avoiding the REQUIREMENT to have the app installed, but utilising it if it is.

This suggests that authentication away from the app is supported.

Reportedly, @AroundThen has had success with this process.

Good luck!

*1 I'm currently having trouble finding his post, but basically he provided login credentials that Apple attempted to use, but had locality issues and hence couldn't get in, but it was inferred they may have approved it if they had of.



来源:https://stackoverflow.com/questions/33602928/using-linkedins-ios-9-sdk-for-authentication-with-a-webview-instead-of-linkedin

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!