Jin-seok  Lee
Jin-seok Lee

Reputation: 31

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

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).

Upvotes: 3

Views: 3983

Answers (2)

Betul Senoglu
Betul Senoglu

Reputation: 1

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

Upvotes: 0

Ayo &#39;Lana
Ayo &#39;Lana

Reputation: 137

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

Upvotes: -1

Related Questions