GithubHelp home page GithubHelp logo

hoauth's People

Contributors

art-x avatar fredt69 avatar gigitsu avatar marianoarga avatar oinegue avatar prplhaz4 avatar shark0n avatar sleepwalker avatar telmodias avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hoauth's Issues

Problem on Login

Hi! i'm test your extension and liked very much! but i have a problems on login. Yii send this message -- Illegal string offset 'php_session_id' -- The error

FILE = hybridauth\Hybrid\Storage.php(30)

public function config($key, $value=null)
26 {
27 $key = strtolower( $key );
28
29 if( $value ){
30 $_SESSION["HA::CONFIG"][$key] = serialize( $value );
31 }
32 elseif( isset( $_SESSION["HA::CONFIG"][$key] ) ){
33 return unserialize( $_SESSION["HA::CONFIG"][$key] );
34 }
35
36 return NULL;
37 }

user cancellation

  1. Sign in with Facebook credentials from your application
  2. Refuse that your application access to facebook data

Then you are facing following error:
"Trying to get property of non-object"
HOAuthAction.php line 178

It seems that exception #5 is not handled. My current fix is the following:

Change in UserOAuth.php at line 215:

catch( Exception $e )
{
$error = "";
switch( $e->getCode() )
{
case 6 : //$error = "User profile request failed. Most likely the user is not connected to the provider and he should to authenticate again.";
case 7 : //$error = "User not connected to the provider.";
$this->logout();
return $this->authenticate($provider);
break;
}
}

into

catch( Exception $e )
{
$error = "";
switch( $e->getCode() )
{
default:
$this->logout();
throw $e;
break;
case 6 : //$error = "User profile request failed. Most likely the user is not connected to the provider and he should to authenticate again.";
case 7 : //$error = "User not connected to the provider.";
$this->logout();
return $this->authenticate($provider);
break;
}
}

But i'm doubting of myself, this issue seems too obvious...

Add social auth association if user is already logged in and oauth is triggered

Currently, the only ways to associate a social authentication with a user is that

  1. user already exists, and matches on emailVerified (which very few providers implement)
  2. user does not exist, and a new user is created

I'm proposing adding a 3rd scenario, where the user is already logged in:
3. user is already logged in, save provider association in user_oauth table for currently logged in user (Yii::app()->user->id, provider, identifier, session)

Trying to get property of non-object

Just set up a new YII application, with hoath, and yii_user..
I followed all the directions to the letter, and install went fine but when I go to login I am getting a error.

full: http://pastebin.com/f8pWeYif
summary: Trying to get property of non-object
/var/www/gametoken/protected/extensions/hoauth/HOAuthAction.php(178)

URL: /index.php?r=site/oauth&provider=Google

The only provider I sat up was google, and disabled the rest for testing.

New to YII, and hoauth, so it most likely me, but after beating my head against the wall for a day, I decided to spot as a issue.. hope you can help..

Small Error Handling Error...

Found a small bug while debugging my setup...

https://github.com/SleepWalker/hoauth/blob/master/HOAuthAction.php#L358
need to change:
$user->errors
to
$profile->errors

Found this because my test account had a last name of "."

Error thrown after fixed was:
array (
'last_name' =>
array (
0 => 'Last Name is too short (minimum is 3 characters).',
),
)

It would actually be awesome if it could prompt the user to update the field if something like this happens.. but might be pie in the sky...

Attibutes Mapping not used

Hy,

After installing and setting parameter, I can't login/signin.
Every time I get error like :

2014/09/21 12:38:48 [error] [exception.CException] exception 'CException' with message 'Property "User.email" is not defined.' in website/protected/vendor/framework/base/CComponent.php:130
Stack trace:
#0 website/protected/vendor/framework/db/ar/CActiveRecord.php(145): CComponent->__get('email')
#1 website/protected/extensions/hoauth/HOAuthAction.php(234): CActiveRecord->__get('email')
#2 website/protected/extensions/hoauth/HOAuthAction.php(163): HOAuthAction->getAccessCode()
#3 website/protected/extensions/hoauth/HOAuthAction.php(136): HOAuthAction->oAuth('Live')
#4 website/protected/vendor/framework/web/actions/CAction.php(76): HOAuthAction->run()
#5 website/protected/vendor/framework/web/CController.php(308): CAction->runWithParams(Array)
#6 website/protected/vendor/framework/web/CController.php(286): CController->runAction(Object(HOAuthAction))
#7 website/protected/vendor/framework/web/CController.php(265): CController->runActionWithFilters(Object(HOAuthAction), Array)
#8 website/protected/vendor/framework/web/CWebApplication.php(282): CController->run('oauth')
#9 website/protected/vendor/framework/web/CWebApplication.php(141): CWebApplication->runController('site/oauth')
#10 website/protected/vendor/framework/base/CApplication.php(180): CWebApplication->processRequest()
#11 website/index.php(13): CApplication->run()
#12 {main}
REQUEST_URI=/site/oauth?provider=Live

After some research doing a CVardump to the $user give :

[trace] [application] Test User: User#1
(
    [CActiveRecord:_new] => false
    [CActiveRecord:_attributes] => array
    (
        'USER_ID' => '2'
        'USERSTATE_ID' => '2'
        'USERCLASS_ID' => '3'
        'USER_LASTNAME' => 'LASTTest'
        'USER_FORNAME' => 'FORTest'
        'USER_EMAIL' => '[email protected]'
        'USER_PASSWORD' => 'hashedpassword'
    )
    [CActiveRecord:_related] => array()
    [CActiveRecord:_c] => null
    [CActiveRecord:_pk] => '2'
    [CActiveRecord:_alias] => 't'
    [CModel:_errors] => array()
    [CModel:_validators] => null
    [CModel:_scenario] => 'update'
    [CComponent:_e] => null
    [CComponent:_m] => null
)

But even using $user->_emailAttribute or $user->USER_EMAIL give a null value making a null identity etc..

All other part of website run, so I don't know why here...

PS: will be good to precise what getId / getName must return in UserIdentity for who don't use yii-user.

My Config:

'oauth' => array(
    // the list of additional properties of this action is below
    'class' => 'ext.hoauth.HOAuthAction',
    'model' => 'User',
    // model attribute => profile attribute
    'attributes' => array(
        'USER_EMAIL' => 'email',
        'USER_FORNAME' => 'firstName',
        'USER_LASTNAME' => 'lastName',
    ),
),

System Spec :
PHP 5.4.33
Yii yii-1.1.15.022a51
hoauth 1.2.5

Hardcoded config file

Having the config file name hardcoded in the extension makes it cumbersome to load a different config depending on environment.

Specifically, using yii-environment extension to manage configs.

One solution would be to allow override of config filename in Yii::app()->params

Installation error when CSRF is enabled

When CSRF is enabled on the site the installation process fail.
I think that the CSRF token is not send along with the other data in the POST request.

But since the installation file is from Hybrid Auth, the issue is not really easy to solve ...

Setting fields before saving user data

Is it possible to set certain fields (like timezone, country, etc.) to related User model before hoauth saves User data? For example, when user registers using Facebook account, application could retrieve various data from his Facebook account and save it to User model.

If it is possible, where should we place the code? I saw we only have 2 callbacks (i.e. hoauthAfterLogin and hoauthCheckAccess) and User model has been created when they are called.

Property "User.fname" is not defined

I click the facebook link, but got the following error. Where is User.fname is defined? Did I miss any step during installation?

"Unspecified error.

Original error message: Property "User.fname" is not defined."

Update User Status

How do I update a user's status? For example, updating a logged-in (connected) Facebook user's status.

For example, with hybridauth, I do this:

    $adapter = $hybridauth->authenticate( $provider );
    $adapter->setUserStatus($message);

But how can I do that using this library?
Thanks.

Hoauth with humhub

Hi,

I am trying to integrate hoauth with humhun but the Yii::app()->user->isGuest is always true. How to fix this?

I followed the steps for installation but I am not able to make user login using FB.

Regards
Pvnarula

Getting hoauth to work on localhost

Hi....I'm trying to integrate this extension in my customised Yii application on localhost (Windows 7 and XAMPP). When I invoke the login form of my application, I get the CException error "The config.php file doesn't exists". Can you pls help me?

Honestly, I did not understand the instruction 4 in "README.md" - as in here:

#4. Visit your oauthadmin action (eg. http://yoursite.com/site/oauthadmin) to create the HybridAuth config. For your HybridAuth Endpoint URL use this: http://yoursite.com/site/oauth. After install you can leave install.php in your file system, while it's in Yii protected directory. But you must remove oauthadmin action, or make such rules, that give access only for admin users. Config file can be found at application.config.hoauth

[Question] Graph API version

Hello, Facebook contact me saying my app is making calls to v1.0 of the Graph API which will be deprecated, do you know how to avoid this version issue?
Thank you.

facebook error while saving User model

First when trying to integrate with facebook I got errors for missing User mode properties:

  • fname
  • lname
  • gender
  • birthday
  • acc_status

After I added them to the model and to the DB I got the following error:

Error, while saving User model:

array (
'username' => 
array (
0 => 'Username cannot be blank.',
),
'password' => 
array (
0 => 'Password cannot be blank.',
),
)

What should I do?

Hybridauth renewed

Please, be advised that hybridauth lib back to live and found new mantainers. At now a lot of fixes applying, and finally it expected to get the new version tag.

Guess you need to prepare new release of hoauth because some fixes are important.

Have a good luck!

Logic error in UserOAuth.php

Scenario:
Let's say user has 2 gmail accounts [email protected] and [email protected]
First he logs on the site. It will create the user normally . It logs out and logs back in with the second gmail account . While logged send time on [email protected] time puts on user email [email protected] when creating the account.

( i think it can be reproduced by having 2 facebook accounts as well )

It will generate the following error:
"Original error message: CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1-Google' for key 'unic_user_id_name'. The SQL statement executed was: INSERT INTO tbl_user_oauth (provider, profile_cache, identifier, session_data, user_id) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4)"

Error is in UserOAuth.php line 269

    public function bindTo($user_id)
    {
            $this->user_id = $user_id;
            return $this->save();
    }

attributes country and city

'attributes' => array(
'email' => 'email',
'name' => 'firstName',
'lastName' => 'lastName',
'gen' => 'genderShort',
'birthDate' => 'birthDate',
'activationstatus' => 1,
'username'=>'displayName',
_____________________
'country'=>'country',
'city'=>'city',
____________________

in my database the fileds country and city return null, how I add more attributes

Using existing email address with Facebook

When you sign up using Facebook and use a existing email address it will ask you to change the email address or enter password.

If you change the email address it will allow you access to the existing account when it should create a new one.

Display form before saving user data

Can we display a form after user logs in to his social network account? So before application saves data to User table, it will ask user to accept Terms/Policy and fill certain fields that cannot be retrieved from his social network account.

As mentioned in issue #38, it seems we can use hoauthProcessUser($user, $userProfile) callback. However, I'm still not sure how to use it to display form and what code that needs to be copied from HOAuthAction::processUser() method.

Avoiding modification of the user module

I have set-up hoauth and it works great. However I would like to avoid modifying the user module files directly and keep them as a clean git submodule in our project (having external modules that cannot be updated easily sounds dangerous in the long term).

It's easy enough inserting the widget in the view with a theme, but is there any way I can avoid modifying the Login Controller's actions in the module file itself?

please add to packagist/composer

This will allow simple installation outside of my application's path. Let me know if you need a sample composer.json and I will do a pull request.

Login OK but can't call UserOAuth::

I have set up hoauth on top of yii-user carefully following the installation guide.

I can login/register with Gmail provider, and display my profile.

However when I try the example in the doc :

$userOAuths = UserOAuth::model()->findUser(5); // find all authorizations from user with id=5
foreach($userOAuths as $userOAuth)
{
  $profile = $userOAuth->profile;
  echo "Your email is {$profile->email} and social network - {$userOAuth->provider}<br />";
}

I get a "include(UserOAuth.php): failed to open stream: No such file or directory" error.

phpinfo() shows OAuth is enabled on my server.

What am I doing wrong ?

error 500

Dear developer,

your extention have issue.
that issue is "error 500 include(loginController)". that issue come to pass when i click deny in G+ or cancel in facebook. so how to fixed ?

Thanks

How does it connect with yii-user

I saw hoauth has it's own database "user_oauth"
I'm wondering how it can connect with yii-user if their table are different. If I'm taking user ID from yii-user table, I guess it's not the same as one from "user_oauth"

problem with popup box

Hi @SleepWalker,

Thank you for Awesome work!
I have installed hoauth with yii-user extensions, and everything seems working fine. In hoauth config file i have set configuration something like below

return 
    array(
        "base_url" => "http://dev.localhost.com/user/login/oauth",

        "providers" => array ( 
            "Facebook" => array ( 
                "enabled" => true,
                "keys"    => array ( "id" => "FOO", "secret" => "FOO" ),
                "display" => "popup"
            ),
         ),
       )

Here is just a sample config for Facebook.

What my problem is, when i click on facebook login button, it shows me a pop up and then i am entering my fb login credential and after successfully login in FB it is not taking me back to parent window but instead of that it shows me website in pop up itself. So logically it should take me to the website and over there i can select username & email id.

I am not sure how to do this? if you have such config setting then please let me know.
or else i have to make changes widget code.

many thanks in advance!

hoauthProcessUser callback hasn't the user profile as param

From what I see in the code the hoauthProcessUser hasn't the user profile in its params but if the user is new or not.
On the other side the processUser has the profile as a param.

if($this->alwaysCheckPass || $user->isNewRecord)
        if(method_exists($this->controller, 'hoauthProcessUser'))
            $user = $this->controller->hoauthProcessUser($user, $newUser);
    else
        $user = $this->processUser($user, $userProfile);

Wouldn't be better if hoauthProcessUser also had profile informations?

The main issue is that if we add a param to the callback it will break compatibility with older implemented callbacks.

Return URL

Hi,

I've managed to integrate hoauth (without Yii-User) my logins for Facebook and Google as SN provider, but it only manages to login if for example http://example.com/index.php/en/user/oauth?provider=google is made in the main window and not in the popup window. So my question is, how do I enable it to login when there is the popup windows for the providers?

Popup Window
1-1
1-2

Direct
2-1
2-2

I am Unable to fetch all contacts

in getUserContacts() method i am getting only 25 contacts. But in my Gmail i have 470 contacts... can i know where is the main problem....

social login click renders blank window

after copying all the files and directories in my hoauth directory , i configured my apps by going to the link http://mysite.com/index.php?r=site/oauthadmin . I finished my configuration and when i clicked the login buttons a new window opens with the url http://mysite.com/index.php?r=site/oauth&provider=Google but the window remains blank. Initially it was showing the permission window but now it comes to be blank every time...i reverted all the changes i made to any of the files in the hoauth directory but still nothing changes

After facebook connect I am redirected to admin profile

Hello,

I'm having a problem with facebook connect with hoauth and yii-user installed;
I try to create a new authenticated user by using facebook connection. When I click on facebook button , the facebook login is open and when I login to facebook, I am redirected to the admin profile !!

Any idea ?

Extension does not honor table prefixes

table name is hardcoded, and should be

    /**
     * @return string the associated database table name
     */
    public function tableName()
    {
        return '{{user_oauth}}';
    }

but this will break the table renaming hack, which should exist as a migration, not in the model script (IMO).

I have a migration for the table creation, but not one that will update it between the two existing versions (if you would like it).

How to call getUserContacts()?

$adapterFacebook = UserOAuth::model()->authenticate("Facebook");
$adapterFacebookContacts = $adapterFacebook->getUserContacts();

Prepopulated username contains illegal characters (spaces) after Facebook sign-in

When mew users log in with Facebook, they must enter a username before completing their registration with the website. The username field is prepopulated with their Facebook name, which contains a space (e.g. "John Smith"). But usernames cannot contain spaces, which causes an error if they try to save the prepopulated username. That's not a great user experience. This may be because I'm using Yii-User, which has it's own set of rules for usernames. Would be great if hoauth could replace spaces with underscores, or remove them, or take some other action to make it easier for users to create a new account.

After Facebook login it won't redirect anywhere

Hey guys,

Have anyone had this problem? The thing is that, when you are not connected to your facebook account, when you try to authenticate in your website, it opens the login page of facebook, but when you submit your email/password, it leaves you there in a blank page. It logs in though, because if you try again to click on "Login with Facebook" it will work.

Any ideas?

Incorrect association of the authenticated provider with the logged-in user

Dear All

The issue is that if the user has already logged in and tried to log in again, then the associated record's user_id in the user_aouth table is set to 0. I guess the user_id is int and the code is trying to put the email address in Yii::app()->user->id there. Then again the Yii::app()->user->id should not have been an email address in the first place.

protected function getAccessCode()
{
$oAuth = $this->oAuth;
// If we already have a user logged in, associate the authenticated
// provider with the logged-in user
if(!Yii::app()->user->isGuest) {
$accessCode = 1;
$oAuth->bindTo(Yii::app()->user->id);
} else {

Widget to display social networks, that connected to the user's local account

This widget will simply aggregate user's social network connections and will display the list of links

<ul class="hoauthSNList">
<li><a href="linkToProfile">Social network</a></li>
...
</ul>

It will be also new column "profile" in db created, where we will cache user's profile object. And of course all widgets should be moved to widgets directory.

Authentication Framework

Probably we should change authentication framework (for example to this), because HybridAuth is not maintained...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.