Sitecore Social Connected Exception: "Application in args should not be null"

Search for a command to run...

No comments yet. Be the first to comment.
Polly is great library for easily configuring different kinds of policies around code execution, be it retry, circuit breaker, caching or lots of other things. It's probably most often used around HTTP requests. If you haven't heard about it you defi...

This is part 2 of my series on unit testing in .NET (C#) and will be about my conventions regarding naming unit tests, how to structure them and which parts to test. And lastly I will help you increase readability of assertions and potential error me...

I feel like unit testing is very important and very beneficial in a lot of ways. It helps with not breaking existing functionality and thereby also making you more confident in changing code without fear of breaking important stuff. Often it also mak...

I've been working with Swagger through NSwag a lot recently and also needed to get it to work when hidden behind a reverse proxy - i.e. another service forwarding a request to the service exposing the Swagger UI. Some of the issues I've had along the...

The other day I was writing a unit test to verify what was supposed to happen when a Task would throw an exception when awaited. It wasn't as straight forward as I first assumed, but I quickly found this Stack Overflow post that helped me: https://st...

You might run into this exception when trying to log in using one of the social connectors that is part of the Sitecore Social Connected module (Facebook, Twitter, LinkedIn, Google+)
ERROR Sitecore.Social: Application in args should not be null
Exception: Sitecore.Social.NetworkProviders.Exceptions.AuthException
Message: Exception of type 'Sitecore.Social.NetworkProviders.Exceptions.AuthException' was thrown.
Source: Sitecore.Social.NetworkProviders
at Sitecore.Social.NetworkProviders.Exceptions.Analyzers.ArgsExceptionAnalyzer.Analyze(AuthArgs args)
at Sitecore.Social.Client.Connector.SocialLogin.ProcessRequest(HttpContext httpContext)
I ran into this exception the other day and was a bit confused at it had been working fine.
It turns out a change had been made to our setup to always include the language as the first part in the URL - and if it was missing it would redirect to the correct URL including the language part.
When you click on one of the Social Connector buttons to log in, the module makes a POST request to /Social/TwitterConnector/Login (or the equivalent for the other connectors). These use standard MVC to generate a form which points to the Login method on the corresponding controller.
@using (Html.BeginForm("Login", null, new { area = "Social" }, FormMethod.Post, new { style = "display:inline" }))
{
@Html.HiddenFor(model => model.Parameters)
<input type="image" title='@Model.ToolTip' style="margin:0 1px" src="@Url.Content(Model.Icon)" />
}
The redirect logic that was setup was also redirecting POST requests, but redirected POST requests turn into GET and also no longer include the form parameters.
So what can we learn from all this?
Do not redirect POST requests. Please.