Oauth 2.0 authorization for LinkedIn in Android

前端 未结 4 1557
借酒劲吻你
借酒劲吻你 2020-11-27 15:07

Even though there is no such android specific sdk from linkedIn(like facebook and twitter sdk for android).Setting up linkedIn authorization with Oauth 1.0 was still easy us

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-27 15:17

    OAuth 2.0 is much simpler than 1.0 and can be done without any help from an external library. However, if you are already using scribe-java, it will be even easier.

    The implementation is straight-forward. You need to create a WebView that has a custom WebViewClient which captures and overrides loading behavior for your callback URL. Thus, when the WebView attempts to load that URL, you can intercept the process and extract a verifier. The verifier can be passed to scribe-java to exchange for an access token.

    To start the whole process, you just need to tell your WebView to load the authorization URL.

    I have sample code hosted here. The app authenticates with Buffer's API but most of the code can be reused. You may be interested in the fragment which hosts my custom WebView and the background job that gets access token.

    Feel free to ask me any follow up questions.

提交回复
热议问题