2
votes

My facebook login url

https://graph.facebook.com/v2.3/oauth/access_token?client_id=1105783646200782&redirect_uri=http://petmilyapp.com/test3.php&client_secret=69389226fe79865b3ab557f17e8e54ad&code=AQCgR8S7oM2eZWQVP_U8ieBmPcEy_ztQ3LGbcYDsAGWnn0343kOyS6t6_n8AWGggUbF7ib9pU-q4Nr2QBewRMFLe_MROdzpgvhdYwRaFZlr6geC9pESjUrGGNHxEqkjwftVBbmGd4_QOkZAFNJnJQYeW8hvyHhfgiY-W02HTczpMa3PIIGL6OGO0qoRN8KWkBi84qMBNCQ_OF84u-r9kfeoYML9_BUVJf5LCuzIBYBsQmbrNHBwiYKKHyo3MaUC_k2WRirhFk1mSPfWwwihw3U04hIxYX_KG6qSwZ1wmlp3mhYMdP4FuA2VYIg8i7WwZQxyYzonoDyuH6ZuYq_Rb6qi6

response error

message: "Error validating verification code. Please make sure your redirect_uri is identical to the one you used in the OAuth dialog request"

question

What problem in my url? All param is getted facebook dev (my app).

2
As the message says, the redirect_uri parameter must have the exact same value in this API call, as it had in your login dialog call. So go check what value is used when you call the login dialog.CBroe
@CBroe What do you mean with the value used in the login dialog? There is a redirect_uri parameter, and no more parameters associated to the callback url.JCarlosR
The parameter is used in both steps, and the value must be the same.CBroe

2 Answers

0
votes

I know maybe its too late but I just wanted to comment. If you still having this issue, make sure that you have same FacebookCallBack method name everywhere. I mean, for instance I have an External Login function which returns ;

https://www.facebook.com/dialog/oauth?client_id=" + FB_APP_ID + "&redirect_uri=" + System.Net.WebUtility.UrlEncode(pageUrl + "account/**FacebookLoginCallback**?returnUrl=%2F").Replace("%3F", "&") + "&scope=email&enforce_https=1

and also I have a FacebookLoginCallback method which has exactly the same name with I have above. ("account/FacebookLoginCallback?....")

[HttpGet("**FacebookLoginCallback**")]
public async Task<IActionResult> **FacebookLoginCallback**(string code, string returnUrl)
        {
            try
            {
                var myUrl = new Uri(HttpContext.Request.GetDisplayUrl()).GetLeftPart(UriPartial.Authority);
                var pageUrl = new UriBuilder(myUrl);
                var result = (IDictionary<string, object>)fb.Get("oauth/access_token", new
                {
                    client_id = FB_APP_ID,
                    client_secret = FB_APP_SECRET,
                    redirect_uri = pageUrl.Uri.AbsoluteUri.TrimEnd('/') + Url.Action("**FacebookLoginCallback**", "Account", new { returnUrl = returnUrl }),
                    code = code
                });
       }

......
}

Please double check your variable/function names if you have those in your url.

Happy Coding

-1
votes

First, both redirect_uri paramaters to authorize and access_token must match.