Yii Framework Forum: [MODULE] Yiiauth - Yii Framework Forum

Jump to content

  • (3 Pages)
  • +
  • 1
  • 2
  • 3
  • You cannot start a new topic
  • You cannot reply to this topic

[MODULE] Yiiauth a module wrapper for hybridauth

#21 User is offline   Austin T 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 20-June 12

Posted 20 June 2012 - 10:45 PM

I think I've followed every instruction verbatim, but I'm afraid I'm getting this:

Error 404

The system is unable to find the requested action "authenticatewith?openid=http:".
0

#22 User is offline   Cardiff 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 18-August 11

Posted 21 June 2012 - 04:07 AM

This looks really good!
Soon I will try this out and report back. Please keep up the good work :)
0

#23 User is offline   Ne0nx3r0 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 8
  • Joined: 14-December 11

Posted 21 June 2012 - 11:39 AM

I can't seem to get this to work; after following the instructions I get:

Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM in /protected/modules/yiiauth/components/Yiiauth.php on line 31


Any ideas what I'm doing wrong?

*edit* Ignore, it's a fresh install and I haven't setup the User class yet.
0

#24 User is offline   PrplHaz4 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 108
  • Joined: 28-September 09
  • Location:Boston, MA

Posted 22 June 2012 - 12:42 AM

A few notes from me playing with this for a bit...


Be sure to extend your base controller as stated in the instructions...
class Controller extends yiiauth
and
class DefaultController extends Controller //yiiauth default controller


- social extends Model (doesn't exist in my case) - for most I believe this will be CActiveRecord
- UrlFormat is assumed to be path
- path to images assumes app is in webroot...it should prob be prefixed with Yii::app()->basePath or something to be more universal

now trying to figure out why I'm getting this error
The provider 'Facebook' is not enabled.


when using Twitter as the provider
0

#25 User is offline   Sampa 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 173
  • Joined: 18-December 11
  • Location:Stockholm,Sweden

Posted 22 June 2012 - 03:54 AM

View PostPrplHaz4, on 22 June 2012 - 12:42 AM, said:

A few notes from me playing with this for a bit...


Be sure to extend your base controller as stated in the instructions...
class Controller extends yiiauth
and
class DefaultController extends Controller //yiiauth default controller


- social extends Model (doesn't exist in my case) - for most I believe this will be CActiveRecord
- UrlFormat is assumed to be path
- path to images assumes app is in webroot...it should prob be prefixed with Yii::app()->basePath or something to be more universal

now trying to figure out why I'm getting this error
The provider 'Facebook' is not enabled.


when using Twitter as the provider

You have many good points, I'm not relly good at module making. The social extending model is as you say for most CActiveRecord, I have created a Model class in app/components, so that is not really needed for this Yiiauth module.

Can you tell me where u get this error? it is hopefully solved with just an if statement.

Else, I wouldnt mind if others updated errors they find because I have almost no time at all to work on this currently :/
0

#26 User is offline   jiaming 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 262
  • Joined: 10-April 12

Posted 22 June 2012 - 04:49 AM

Has anyone tried to use the "update status" function...?
Still not works for me...

The login works like a charm. You need to fixed some typos though.
0

#27 User is offline   Sampa 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 173
  • Joined: 18-December 11
  • Location:Stockholm,Sweden

Posted 22 June 2012 - 05:13 AM

View Postjiaming, on 22 June 2012 - 04:49 AM, said:

Has anyone tried to use the "update status" function...?
Still not works for me...

The login works like a charm. You need to fixed some typos though.

I'm sorry I dont know what can cause that error for you.. what provider are you logged in

"Trying to get property of non-object" means a $variable is empty, that should contain an object:p I dont know whats diffrent between my code and yours. Perhaps you missed some step?
0

#28 User is offline   PrplHaz4 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 108
  • Joined: 28-September 09
  • Location:Boston, MA

Posted 22 June 2012 - 10:36 AM

View PostSampa, on 22 June 2012 - 03:54 AM, said:

You have many good points, I'm not relly good at module making. The social extending model is as you say for most CActiveRecord, I have created a Model class in app/components, so that is not really needed for this Yiiauth module.

Can you tell me where u get this error? it is hopefully solved with just an if statement.

Else, I wouldnt mind if others updated errors they find because I have almost no time at all to work on this currently :/


Haha...I've never created a module before so prob aren't much help on that front, but figured it might be helpful for others trying to use it.

I get the error after clicking on the Twitter provider icon (defautl /yiiauth)...haven't had a chance to try to fix it yet...but you're probably right about the "if"...
0

#29 User is offline   PrplHaz4 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 108
  • Joined: 28-September 09
  • Location:Boston, MA

Posted 24 June 2012 - 02:26 PM

View PostPrplHaz4, on 22 June 2012 - 10:36 AM, said:

Haha...I've never created a module before so prob aren't much help on that front, but figured it might be helpful for others trying to use it.

I get the error after clicking on the Twitter provider icon (defautl /yiiauth)...haven't had a chance to try to fix it yet...but you're probably right about the "if"...


ok, that was a bit idiotic....the reason I was getting the error was that it was trying to redirect back to the profile page, which has

// Example, ask facebook for friends list
	$response = $this->facebookApi('/me/friends');
	if($response){
	echo "<h1> Example fb api call for friends</h1>";
	var_export($response);
	}

as the first few lines....I don't know why it took me so long to realize that the error was actually being thrown by the profile view, and not any of the Yiiauth controllers.
0

#30 User is offline   Sampa 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 173
  • Joined: 18-December 11
  • Location:Stockholm,Sweden

Posted 24 June 2012 - 04:31 PM

View PostPrplHaz4, on 24 June 2012 - 02:26 PM, said:

ok, that was a bit idiotic....the reason I was getting the error was that it was trying to redirect back to the profile page, which has

// Example, ask facebook for friends list
	$response = $this->facebookApi('/me/friends');
	if($response){
	echo "<h1> Example fb api call for friends</h1>";
	var_export($response);
	}

as the first few lines....I don't know why it took me so long to realize that the error was actually being thrown by the profile view, and not any of the Yiiauth controllers.

haha Well, good notice, I fix that right away. When you get the error message, you can see the stack trace.. in where it almost always shows what line causes the error :)
0

#31 User is offline   PrplHaz4 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 108
  • Joined: 28-September 09
  • Location:Boston, MA

Posted 24 June 2012 - 05:24 PM

View PostSampa, on 24 June 2012 - 04:31 PM, said:

haha Well, good notice, I fix that right away. When you get the error message, you can see the stack trace.. in where it almost always shows what line causes the error :)


The stack trace showed that the error was actually in the Hybridauth file (provider_adapter.php i think), which was the confusing part....either way, definitely my fault, not yours!
0

#32 User is offline   markvr 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 37
  • Joined: 17-June 12

Posted 28 June 2012 - 09:51 AM

Hi,

What license is your code under please? Essentially I need a auth provider like this, but looking at this code it's a bit scrappy :)

I'd like to pull it to pieces and write a new extension that is tidier and more isolated from the application. I'd probably borrow some ideas if not actual code from this extension though if that's ok?
0

#33 User is offline   markvr 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 37
  • Joined: 17-June 12

Posted 29 June 2012 - 02:54 AM

View Postmarkvr, on 28 June 2012 - 09:51 AM, said:

Hi,

What license is your code under please? Essentially I need a auth provider like this, but looking at this code it's a bit scrappy :)

I'd like to pull it to pieces and write a new extension that is tidier and more isolated from the application. I'd probably borrow some ideas if not actual code from this extension though if that's ok?



sorry scrap that, I'm doing it a different way entirely :)
0

#34 User is offline   Sampa 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 173
  • Joined: 18-December 11
  • Location:Stockholm,Sweden

Posted 29 June 2012 - 06:01 AM

View Postmarkvr, on 29 June 2012 - 02:54 AM, said:

sorry scrap that, I'm doing it a different way entirely :)

Ahh, to bad, I've been looking for someone to tidy it up, I'm well aware that its not the best.
I helped a guy to use this with Yii-user-management and I realised yes its kinda messy.

But hybridauth is the by far the easiest and most powerfull way to interact with social providers so someone had to atleast start this:p

Do/borrow/ anything you want.
0

#35 User is offline   markvr 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 37
  • Joined: 17-June 12

Posted 29 June 2012 - 06:16 AM

Requiring the controllers to inherit from yiauth is bad, and requiring hybridauth at the root of the website (i.e. outside protected) isn't ideal either.

Also you extend from Model, which is custom to you, or at least I couldn't find it anywhere!

I'm doing it as a module where
class RemoteUserIdentity extends CBaseUserIdentity


and then RemoteUserIdentity::Authenticate does all the heavy lifting using hybridauth. This makes it essentially a drop in replacement/addition for the forms based auth. The bit that breaks encapsulation is the hybridauth callback that needs to be routed back into RemoteUserIdentity using a controller but there's no way round that really.

It will probably be done in a week or so and I'll post it up.
0

#36 User is offline   Sampa 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 173
  • Joined: 18-December 11
  • Location:Stockholm,Sweden

Posted 29 June 2012 - 07:11 AM

View Postmarkvr, on 29 June 2012 - 06:16 AM, said:

Requiring the controllers to inherit from yiauth is bad, and requiring hybridauth at the root of the website (i.e. outside protected) isn't ideal either.

Also you extend from Model, which is custom to you, or at least I couldn't find it anywhere!

I'm doing it as a module where
class RemoteUserIdentity extends CBaseUserIdentity


and then RemoteUserIdentity::Authenticate does all the heavy lifting using hybridauth. This makes it essentially a drop in replacement/addition for the forms based auth. The bit that breaks encapsulation is the hybridauth callback that needs to be routed back into RemoteUserIdentity using a controller but there's no way round that really.

It will probably be done in a week or so and I'll post it up.

Yeah the extend from Model was a thing I missed to remove, and I choose to extend it from yiiauth so the updateStatus methods etc would be availeble easily everywhere.

The root thing... I tried to find out how to put it somewhere else but I found no answer. I agree on it beeing dumb.

A new UserIdentity class is not ideal either though, since you will still have to extend from it if you use a custom one already.
0

#37 User is offline   markvr 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 37
  • Joined: 17-June 12

Posted 29 June 2012 - 08:19 AM

View PostSampa, on 29 June 2012 - 07:11 AM, said:

Yeah the extend from Model was a thing I missed to remove, and I choose to extend it from yiiauth so the updateStatus methods etc would be availeble easily everywhere.


That's really messy and unscalable, there are better ways of making it available using Yii's excellent autoloading.

Quote

The root thing... I tried to find out how to put it somewhere else but I found no answer. I agree on it beeing dumb.


In the UserIdentity:
require dirname(__FILE__) . '/../Hybrid/Auth.php';
		
		$hybridauth = new Hybrid_Auth($this->_getConfig());


and then in the callback (this is the messy bit):
public function actionCallback() {
		require dirname(__FILE__) . '/../Hybrid/Auth.php';
		require dirname(__FILE__) . '/../Hybrid/Endpoint.php';
		Hybrid_Endpoint::process();
	}

0

#38 User is offline   PrplHaz4 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 108
  • Joined: 28-September 09
  • Location:Boston, MA

Posted 29 June 2012 - 10:15 AM

Thanks a lot guys, great to see this getting some traction! Looking forward to markvr's solution, as I've run into the same problems, but really had no idea where to go from there...
0

#39 User is offline   ramdani 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 14-January 12

Posted 01 July 2012 - 11:31 AM

View PostNe0nx3r0, on 21 June 2012 - 11:39 AM, said:

I can't seem to get this to work; after following the instructions I get:

Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM in /protected/modules/yiiauth/components/Yiiauth.php on line 31


Any ideas what I'm doing wrong?

*edit* Ignore, it's a fresh install and I haven't setup the User class yet.


same as you..
I can't try it.
anybody help us
0

#40 User is offline   markvr 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 37
  • Joined: 17-June 12

Posted 02 July 2012 - 06:46 AM

I've put my first stab at a module to cleanly implement HybridAuth up at http://www.yiiframew...ion/hybridauth/

I'm away for almost 2 weeks now so haven't had time to test it properly (I hate it when people say that as well, sorry), but it's probably enough to be getting on with for now.
0

Share this topic:


  • (3 Pages)
  • +
  • 1
  • 2
  • 3
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users