Linkedin integration in Android - android

I have a problem with linkedin integration in my app. I have created own API's to connect with linkedin.
I have used HttpConnection to get the data and post the data. All the web services are running fine when I run each web service separately but when I run all the web services at a time its showing Http errors.
The first web service is working fine but when it comes to second web service its showing Http error code 401.
Please can anyone let me know why is it not working.

If you're not using a standard OAuth library there are various pitfalls you can encounter when trying to sign requests. There's an existing Android library linkedin-j on the LinkedIn Libraries and Tools page here:
https://developer.linkedin.com/documents/libraries-and-tools
That having been said, if you want to proceed with your own OAuth implementation, there are a few things you can do to try to troubleshoot issues. A 401 error usually means that the OAuth signature is incorrect, so I suspect one of the following is happening:
Your code is re-using the signature from a previous request
Your code is making a different type of request (POST vs. GET)
You're adding query parameters directly via the URL
Each of these can cause the incorrect signature to be generated when the OAuth signature generation isn't being done correctly.
There's a page on common OAuth errors here:
https://developer.linkedin.com/documents/common-issues-oauth-authentication
And a page on debugging API calls here:
https://developer.linkedin.com/documents/debugging-api-calls
The OAuth Test Console here can be used to verify that the signature you're generating is correct for the call you're making:
https://developer.linkedin.com/oauth-test-console
Good luck, and if you're still having trouble try posting your request headers/body and response headers/body so it's possible to troubleshoot.

scribe.jar is another third party jar that you can use for linkedin integration to android application.It encapsulates all the linkedin functions like getting profile informations, posting network updates, etc and very simple to use. You can find examples here : https://github.com/fernandezpablo85/scribe-java/blob/master/src/test/java/org/scribe/examples/LinkedInExample.java

Related

How to get token for android OAuth?

I need to send post request to get token from here https://developers.google.com/android-publisher/authorization
But on step 4 I don't have client_secret
I have code / client_id / redirect_uri the JSON does not have it
The most recommended mobile solution is to use AppAuth libraries, which involves these 2 steps:
Use Authorization Code Flow (PKCE)
Login via System Browser (Chrome Custom Tabs)
In this case the request to get a token uses a runtime code_verifier rather than a client_secret. My blog posts and code sample may give you something to compare against, but mobile OAuth can be quite intricate.
Google Mobile OAuth
Google generally recommend AppAuth for mobile logins. The playmarket API is just a scope value, so I see no reason why it wouldn't work.
References to client secrets in the Playmarket page may just be incomplete documentation. I haven't used this particular API but have used similar Google resources.
Quick Next Steps I'd Recommend
Try running the Google AppAuth sample - this blog post of mine makes this very easy.
Then repoint the sample to your Google Auth Server and add the Playmarket scope. You should then get a token and be able to successfully access Playmarket resources.
If there are no problems, integrate the solution into your own app. If you run into usability problems, have a read of my blog posts.
Coding Aspects
Not sure what language you're using, but my Kotlin sample code uses the libraries with a modern async await syntax.

Fabric Android: login with Twitter and Callback URL

I'm integrating Fabrick SDK in an Android app which has also a Backend to interact with a REST API. This Backend API should be secured, and in the past in other projects (not Android apps) I used both Twitter and Facebook OAuth logins with a calback URL that redirects to my Backend. From there I generate a custom auth token that must be used from the client (in this case, my Android app) to interact with my own API.
The thing is that I've been trying to call a callback URL somehow using Fabric but I could not. I've read the documentation and...
https://dev.twitter.com/twitter-kit/android/configure1
"(...) Callback URL
Although Fabric will ignore the value of the callback URL, it must be set to a valid URL for the app to work with the SDK. (...)"
Does anyone know why is that? There exists any other Twitter API request call accessible from Fabric's Twitter kit to specify a callback URL instead of using the Twitter sign one? There must be a solution for that because most of the developers that uses Twitter for medium to complex software projects including authentication must deal with this kind of problem for sure, but I found nothing.
Regards,
Luis Cappa
Since very recently you have to add twittersdk:// to your app in apps.twitter.com if using Android - twitterkit.
See https://github.com/twitter/twitter-kit-android/issues/135#issuecomment-397395425
Background info https://twittercommunity.com/t/action-required-sign-in-with-twitter-users-must-whitelist-callback-urls/105342
Just list is as your site.
http://www.yourhomepage.com
Twitter supports multiple types of authentication, if it is a regular O-Auth Request, you can just use your site as a placeholder.
See here: https://twittercommunity.com/t/callback-url/398/14

Android application login with google account

I am developing application in which user want to log in with their g mail username and password
,how can i do this and where is sample code and simple tutorial for this.
I already looked many tutorial but i cant understand it properly and may tutorial are very complex.I am trying like this tutorial but it is not run properly mean not getting token
and not finish WebActivity to coming to first activity.
The blog I used a couple of years ago was Nick's blog
http://blog.notdot.net/2010/05/Authenticating-against-App-Engine-from-an-Android-app
It's fairly straight forward. There are two steps
Get Authtoken from the Android Authentication Manager
Make a http(s) request to your appengine app (/_ah/login end point) with the authtoken which will respond with a cookie. Read the cookie and use for all future requests to appengine.
You can follow the blog directly, but since the blog was written Google have made a GoogleAuthUtil available that simplifies step 1. of getting the auth token. This class however requires the play framework installed.

Facebook authentication from android using secret key and app id but not signature

Basically I am developing an android application which can post updates to my facebook wall through my web application server. So actually my web application post my updates in facebook. I am authorizing my android application like a webapp and not as a native android app. I downloaded the facebook for android SDK and tried examples by creating signature using keytool. I am able to post the updates from android as native app. From my web application, I am not able to post my updates through the access token I get.
I am not able to find an android example for facebook SDK which uses the secret key and app id for getting the access token. Can you please give me some pointers on how to achieve the same using facebook SDK..
Thanks.
I haven't tried this yet but there is documentation online and it's quite clear:
You can find the description for al the methods at the following link
https://developers.facebook.com/docs/reference/androidsdk/authentication/
You can also have a look at the code, if something isn't clear enough
https://github.com/facebook/facebook-android-sdk/blob/master/facebook/src/com/facebook/android/Facebook.java
As far as I can tell you don't actually need the app secret in order to authenticate, only the app id. This is because it would be quite insecure to put the app secret on the phone(in the apk) since someone could retrieve it. So the resulting token will expire after a fairly short amount of time(couple of hours or so).
Also here's the complete guide to using the Facebook SDK on Android for authentication:
https://developers.facebook.com/docs/mobile/android/build

Android Google App Engine OAuth difficulties

I have an Android / GAE application. We need to validate the Android user against GAE using OAuth.
We're currently using the Signpost library for this.
We've run through lots of the samples out there and we do seem to get a correct token.
Our problem is once we go to use that token to on our site - we get a 401 - Authorization Failed. The trace from GAE is below:
##TRACE## APIBase:: authenticate() InvalidOAuthParametersError!
The client provided OAuth parameters with the request, but they are invalid.
We've tripple checked our consumer keys, and the other information and we don't know really where to do from here.
Does anyone have any Android to GAE examples that they've used successfully?
Thanks
I learned a lot from the Android2Cloud guys
You can see how they do it at http://code.google.com/p/android2cloud/

Categories

Resources