CsharpBeginner CsharpBeginner - 4 months ago 11
C# Question

Error while authenticating an app with linkedin

Im getting the following error while trying to authenticate with LinkedIn.
"Invalid redirect URI"

The link is valid and registered with my app inside the linked in developer site.

What could cause this error?

var auth = new OAuth2Authenticator
(
clientId: "MYID",
scope: "r_basicprofile",
authorizeUrl: new Uri("https://www.linkedin.com/uas/oauth2/authorization?response_type=code&client_id=MYID&redirect_uri=https://wicareerpathways.org/&state=987654321&scope=r_basicprofile"),
redirectUrl: new Uri("https://wicareerpathways.org/")
);

Answer

Try something this :

var auth = new OAuth2Authenticator (
                clientId: "**",
                clientSecret:"**",
                scope: "r_fullprofile r_contactinfo",
                authorizeUrl: new Uri ("https://www.linkedin.com/uas/oauth2/authorization"),
                redirectUrl: new Uri ("http://www.***.co.nz/"),
                accessTokenUrl:new Uri("https://www.linkedin.com/uas/oauth2/accessToken")    
            );

Refer : https://forums.xamarin.com/discussion/comment/49244/#Comment_49244