Hi,
I'm actually trying to do a simple login with Linkedin and the new API V2 with Xamarin.Auth extension. I do get the token like this
var auth = new OAuth2Authenticator( clientId: *****, clientSecret: *****, scope: "r_liteprofile", authorizeUrl: new Uri("linkedin.com/oauth/v2/authorization"), redirectUrl: new Uri(*****), accessTokenUrl: new Uri("linkedin.com/oauth/v2/accessToken") );
but when I try to make a request it fails with an {"serviceErrorCode":100,"message":"Unpermitted fields present in PARAMETER: Data Processing Exception while processing fields [/access_token, /format]","status":403}. Code for these error:
var request = new OAuth2Request( "GET", new System.Uri("api.linkedin.com/v2/me?" + "format=json" + "&oauth2_access_token=" + e.Account.Properties["access_token"]), null, e.Account ); var linkedinResponse = await request.GetResponseAsync(); var json = linkedinResponse.GetResponseText(); Console.WriteLine(json);
If I take out the fields, it fails because of empty access token: {"serviceErrorCode":65604,"message":"Empty oauth2 access token","status":401} Code for these error:
var request = new OAuth2Request( "GET", new System.Uri("api.linkedin.com/v2/me"), null, e.Account ); var linkedinResponse = await request.GetResponseAsync(); var json = linkedinResponse.GetResponseText(); Console.WriteLine(json);
I've confirmed that I've recieved the token. Looking for a solution I found that the token must be in a header but I can't change or add any header. Can anyone help me please?
Thank you very much.
PD: all links to linkedin has the Hyper Text Transfer Protocol Secure and/or World Wide Web prefix but I cant post links yet.
Hi finally I found the solution to this.
In Linkedin API V2 you have to change your AccessTokenparameterName.
yourOauth2Request.AccessTokenParameterName = "oauth2_access_token";
Hope I can help somebody to not get mad like me.
Answers
Hi finally I found the solution to this.
In Linkedin API V2 you have to change your AccessTokenparameterName.
yourOauth2Request.AccessTokenParameterName = "oauth2_access_token";
Hope I can help somebody to not get mad like me.