Bad request for callback URL

I’m currently in the process of creating a custom-social-connection for my login page. I have successfully called out to my social connection and I am able to log in using that, however I then get a Status Code 400 Bad Request when trying to access the callback url (The url is (https://‘tenant domain’/login/callback?code=‘code’). This leads to the error message You may have pressed the back button, refreshed during login.

I have ensured that the callback url is listed in the Allowed Callback URLs section of the application but still no joy. Any ideas?