Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

From Facebook: The redirect_uri URL must be absolute #18

Open
scottybe opened this issue Apr 12, 2013 · 16 comments
Open

From Facebook: The redirect_uri URL must be absolute #18

scottybe opened this issue Apr 12, 2013 · 16 comments

Comments

@scottybe
Copy link

I get the following error when I try to login via FaceBook: "The redirect_uri URL must be absolute". That is coming directly from Facebook.

When I look in hybridauth.log, the [hauth_return_to] property contains the complete url (starting with "http://"), but the [login_done] property does not.

Also, the last entry is "Enter Hybrid_Auth::redirect( https://www.facebook.com/dialog/oauth?........" but the redirect_uri parameter does not contain the complete url which I'm sure is causing the error back from Facebook.

Where do I set the complete URL in my configuration?

Thanks!

@andacata
Copy link
Owner

Can you paste the relevant part of the log (deleting sensitive data) from "Enter Hybrid_Auth::initialize()" until the end?

@scottybe
Copy link
Author

Thanks!

my development server IP is xxxxxx and my application is in directory yyyyyy. The config base_url is "/yyyyyy/hauth/endpoint".

INFO -- 50.58.207.6 -- 2013-04-12T12:36:45-05:00 -- Enter Hybrid_Auth::initialize()
INFO -- 50.58.207.6 -- 2013-04-12T12:36:45-05:00 -- Hybrid_Auth::initialize(). PHP version: 5.3.8
INFO -- 50.58.207.6 -- 2013-04-12T12:36:45-05:00 -- Hybrid_Auth::initialize(). Hybrid_Auth version: 2.1.2
INFO -- 50.58.207.6 -- 2013-04-12T12:36:45-05:00 -- Hybrid_Auth::initialize(). Hybrid_Auth called from: http://xxxxxx/yyyyyy/hauth/endpoint?hauth.start=Facebook&hauth.time=1365788205
DEBUG -- 50.58.207.6 -- 2013-04-12T12:36:45-05:00 -- Hybrid_Auth initialize. dump used config: -- a:8:{s:8:"base_url";s:28:"/yyyyyy/hauth/endpoint";s:9:"providers";a:10:{s:6:"OpenID";a:1:{s:7:"enabled";b:0;}s:5:"Yahoo";a:2:{s:7:"enabled";b:0;s:4:"keys";a:2:{s:2:"id";s:0:"";s:6:"secret";s:0:"";}}s:3:"AOL";a:1:{s:7:"enabled";b:0;}s:6:"Google";a:2:{s:7:"enabled";b:0;s:4:"keys";a:2:{s:2:"id";s:0:"";s:6:"secret";s:0:"";}}s:8:"Facebook";a:2:{s:7:"enabled";b:1;s:4:"keys";a:2:{s:2:"id";s:15:"AAAAAAAAAAAAAA";s:6:"secret";s:32:"ZZZZZZZZZZZZZZZZZZZZZZZ";}}s:7:"Twitter";a:2:{s:7:"enabled";b:0;s:4:"keys";a:2:{s:3:"key";s:0:"";s:6:"secret";s:0:"";}}s:4:"Live";a:2:{s:7:"enabled";b:0;s:4:"keys";a:2:{s:2:"id";s:0:"";s:6:"secret";s:0:"";}}s:7:"MySpace";a:2:{s:7:"enabled";b:0;s:4:"keys";a:2:{s:3:"key";s:0:"";s:6:"secret";s:0:"";}}s:8:"LinkedIn";a:2:{s:7:"enabled";b:0;s:4:"keys";a:2:{s:3:"key";s:0:"";s:6:"secret";s:0:"";}}s:10:"Foursquare";a:2:{s:7:"enabled";b:0;s:4:"keys";a:2:{s:2:"id";s:0:"";s:6:"secret";s:0:"";}}}s:10:"debug_mode";b:1;s:10:"debug_file";s:71:"C:/xampp/htdocs/yyyyyy/system/../application//logs/hybridauth.log";s:9:"path_base";s:71:"C:\xampp\htdocs\yyyyyy\application\third_party\hybridauth\Hybrid/";s:14:"path_libraries";s:82:"C:\xampp\htdocs\yyyyyy\application\third_party\hybridauth\Hybrid/thirdparty/";s:14:"path_resources";s:81:"C:\xampp\htdocs\yyyyyy\application\third_party\hybridauth\Hybrid/resources/";s:14:"path_providers";s:81:"C:\xampp\htdocs\yyyyyy\application\third_party\hybridauth\Hybrid/Providers/";}
DEBUG -- 50.58.207.6 -- 2013-04-12T12:36:45-05:00 -- Hybrid_Auth initialize. dump current session: -- a:3:{s:38:"hauth_session.facebook.hauth_return_to";s:60:"s:52:"http://xxxxxx/yyyyyy/hauth/login/Facebook";";s:37:"hauth_session.facebook.hauth_endpoint";s:56:"s:48:"/yyyyyy/hauth/endpoint?hauth.done=Facebook";";s:41:"hauth_session.facebook.id_provider_params";s:345:"a:5:{s:15:"hauth_return_to";s:52:"http://xxxxxx/yyyyyy/hauth/login/Facebook";s:11:"hauth_token";s:26:"lajefkdj05kl55p6mph7t55ip4";s:10:"hauth_time";i:1365788205;s:11:"login_start";s:71:"/yyyyyy/hauth/endpoint?hauth.start=Facebook&hauth.time=1365788205";s:10:"login_done";s:48:"/yyyyyy/hauth/endpoint?hauth.done=Facebook";}";}
INFO -- 50.58.207.6 -- 2013-04-12T12:36:45-05:00 -- Hybrid_Auth initialize: check if any error is stored on the endpoint...
INFO -- 50.58.207.6 -- 2013-04-12T12:36:45-05:00 -- Hybrid_Auth initialize: no error found. initialization succeed.
DEBUG -- 50.58.207.6 -- 2013-04-12T12:36:45-05:00 -- Enter Hybrid_Auth::setup( Facebook ) --
DEBUG -- 50.58.207.6 -- 2013-04-12T12:36:45-05:00 -- Hybrid_Auth::setup( Facebook ), no params given. Trying to get the sotred for this provider. -- Array
(
[hauth_return_to] => http://xxxxxx/yyyyyy/hauth/login/Facebook
[hauth_token] => lajefkdj05kl55p6mph7t55ip4
[hauth_time] => 1365788205
[login_start] => /yyyyyy/hauth/endpoint?hauth.start=Facebook&hauth.time=1365788205
[login_done] => /yyyyyy/hauth/endpoint?hauth.done=Facebook
)

DEBUG -- 50.58.207.6 -- 2013-04-12T12:36:45-05:00 -- Hybrid_Auth::setup( Facebook ). HybridAuth Callback URL set to: -- http://xxxxxx/yyyyyy/hauth/login/Facebook
INFO -- 50.58.207.6 -- 2013-04-12T12:36:45-05:00 -- Enter Hybrid_Provider_Adapter::factory( Facebook )
DEBUG -- 50.58.207.6 -- 2013-04-12T12:36:45-05:00 -- Hybrid_Provider_Model::__construct( Facebook ) initialized. dump current adapter instance: -- O:25:"Hybrid_Providers_Facebook":7:{s:5:"scope";s:127:"email, user_about_me, user_birthday, user_hometown, user_website, read_stream, offline_access, publish_stream, read_friendlists";s:10:"providerId";s:8:"Facebook";s:6:"config";a:2:{s:7:"enabled";b:1;s:4:"keys";a:2:{s:2:"id";s:15:"AAAAAAAAAAAAAA";s:6:"secret";s:32:"ZZZZZZZZZZZZZZZZZZZZZZZ";}}s:6:"params";a:5:{s:15:"hauth_return_to";s:52:"http://xxxxxx/yyyyyy/hauth/login/Facebook";s:11:"hauth_token";s:26:"lajefkdj05kl55p6mph7t55ip4";s:10:"hauth_time";i:1365788205;s:11:"login_start";s:71:"/yyyyyy/hauth/endpoint?hauth.start=Facebook&hauth.time=1365788205";s:10:"login_done";s:48:"/yyyyyy/hauth/endpoint?hauth.done=Facebook";}s:8:"endpoint";s:48:"/yyyyyy/hauth/endpoint?hauth.done=Facebook";s:4:"user";O:11:"Hybrid_User":3:{s:10:"providerId";s:8:"Facebook";s:9:"timestamp";i:1365788205;s:7:"profile";O:19:"Hybrid_User_Profile":22:{s:10:"identifier";N;s:10:"webSiteURL";N;s:10:"profileURL";N;s:8:"photoURL";N;s:11:"displayName";N;s:11:"description";N;s:9:"firstName";N;s:8:"lastName";N;s:6:"gender";N;s:8:"language";N;s:3:"age";N;s:8:"birthDay";N;s:10:"birthMonth";N;s:9:"birthYear";N;s:5:"email";N;s:13:"emailVerified";N;s:5:"phone";N;s:7:"address";N;s:7:"country";N;s:6:"region";N;s:4:"city";N;s:3:"zip";N;}}s:3:"api";O:8:"Facebook":9:{s:18:"

@andacata
Copy link
Owner

The value in your "base_url" must be "/hauth/endpoint" (without the application directory part).

@scottybe
Copy link
Author

I don't think that's it. The hauth controller is with my other controllers in the yyyyyy "project" directory, i.e., /yyyyyy/application/controllers/hauth.

So when I take out the yyyyyy directory from the base_url, I get the "Object not found!" error when it looks for the hauth controller. When I leave it in, the hauth controller at least sends the login information to Facebook, but without the 'http://xxxxxx" in the redirect_uri parameter:

INFO -- 50.58.207.6 -- 2013-04-12T12:36:45-05:00 -- Enter Hybrid_Auth::redirect( https://www.facebook.com/dialog/oauth?client_id=AAAAAAAAAAAAAAA&redirect_uri=%2Fyyyyyyy%2Fhauth%2Fendpoint%3Fhauth.done%3DFacebook&state=d7bc0048f7dd9e79bf987654aa9bdb7a&scope=email%2C+user_about_me%2C+user_birthday%2C+user_hometown%2C+user_website%2C+read_stream%2C+offline_access%2C+publish_stream%2C+read_friendlists&display=page, PHP )

@andacata
Copy link
Owner

Which is the value configured in the "base_url" param inside config/config.php ?

@scottybe
Copy link
Author

In config/config.php, $config['base_url'] = 'http://xxxxxx/yyyyyy/';

Looking deeper, in Provider_Model.php, line 59 there is:

   $this->endpoint = Hybrid_Auth::storage()->get( "hauth_session.$providerId.hauth_endpoint" );

It seems to work if I add the following just below it:
$this->endpoint = 'http://xxxxxx/'.$this->endpoint;

This works because hybridauth is sending $this->endpoint as the redirect_uri, but that's probably not the right way to go about it! Maybe 'hauth_session' is not being set correctly?

By the way, there is a chance I downloaded the most recent version of hybridauth to work with the most recent version of hybridigniter and they don't work well together. Could that be it?

@andacata
Copy link
Owner

Can you try with another browser?
I've had problems before with sessions.

@scottybe
Copy link
Author

Same thing: "The redirect_uri URL must be absolute" because 'http://xxxxxx/' is left off.

@andacata
Copy link
Owner

Maybe there is a problem with the subfolder installation. Let me test it. I have no time now, sorry.

@scottybe
Copy link
Author

No problem. Thanks for looking at it. This is a site that I've been working on for quite a while, so I think the overall structure of codeigniter is set up right.

@scottybe
Copy link
Author

I replaced all the files from the latest version of HybridAuth (2.1.2) with the HybridAuth files from your fork (version?), and that fixed my problem. I should have done that first. Sorry to bother you.

@andacata
Copy link
Owner

Can you tell me the differences between the two versions of HybridAuth? Both should be equal.

@scottybe
Copy link
Author

I have no idea. All I know is when I put back the HybridAuth files that were included with the HybridIgniter files, it worked fine. When I replaced those with the files in the latest version of HybridAuth, I ran into the problem with the incomplete "redirect_uri" parameter of the https://www.facebook.com/dialog/oauth redirect. Try it!

@andacata
Copy link
Owner

I'll try it, thanks for the info.

@andacata
Copy link
Owner

I can't see any problem. Also, I can't test it because I can't create a Yahoo application with OpenID authentication (new applications authenticates through OAuth).

The problem occurs with other providers too?

@tenoimelda
Copy link

please help i have error The redirect_uri URL is not supported , i will login with oauth fb in laravel 5.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants