Sharethefun
Sharethefun

Reputation: 824

Facebook Canvas App: API Error Code: 191 : Authentication Error

I'm trying to setup a new facebook app using the example from Facebook but Authentication gives me an error.

I first go developers.facebook.com/setup/ and use the URL of my site (tried both the base and subfolder: http://mydomain.com and http://mydomain.com/facebook-app/ )

Canvas URL : http://mydomain.com/faceboo-app/ Secure Canvas URL: none

My index.php

<?php 


 $app_id = "XXXXXXXXXXXXXXXXXXXX";

 $canvas_page = "http://apps.facebook.com/XXXXXXXXXXXXXXX/";

 $auth_url = "http://www.facebook.com/dialog/oauth?client_id=" 
        . $app_id . "&redirect_uri=" . urlencode($canvas_page);

 $signed_request = $_REQUEST["signed_request"];

 list($encoded_sig, $payload) = explode('.', $signed_request, 2); 

 $data = json_decode(base64_decode(strtr($payload, '-_', '+/')), true);

 if (empty($data["user_id"])) {
        echo("<script> top.location.href='" . $auth_url . "'</script>");
 } else {
        echo ("Welcome User: " . $data["user_id"]);
 } 

?>

When I try to visit http://apps.facebook.com/XXXXXXXXXXXXXXX/

I get:

An error occurred with APP Name. Please try later

API Error Code: 191 API Error Description: The specified URL is not owned by the application Error Message: Invalid redirect_uri: Given URL is not permitted by the application configuration.

Can someone please help?

Upvotes: 1

Views: 1842

Answers (1)

Darvex
Darvex

Reputation: 3644

Ou have to redirect user back to your web, so your $canvas_url variable has to be your web URL (which you entered in app setup)

Upvotes: 2

Related Questions