Coder Social home page Coder Social logo

philsturgeon / codeigniter-oauth2 Goto Github PK

View Code? Open in Web Editor NEW
350.0 350.0 178.0 313 KB

NO LONGER ACTIVELY MAINTAINED. USE https://github.com/thephpleague/oauth2-client INSTEAD

Home Page: http://getsparks.org/packages/oauth2/versions/HEAD/show

PHP 100.00%

codeigniter-oauth2's People

Contributors

alexbilbie avatar andrew-s avatar bnvk avatar calvinfroedge avatar ckald avatar compilerrr avatar crodjer avatar dcrawkstar avatar fdiskas avatar it-can avatar jeremyvaught avatar mindplay-dk avatar philmareu avatar psp83 avatar salamanders 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

codeigniter-oauth2's Issues

OAuth2_Provider_Facebook wrong nickname

On line 32 when it says:

'nickname' => $user->username,

I think it should be:

'nickname' => $user->nickname,

Since I'm getting an error actually and there is no username on my Facebook response.

Spark warning

On spark install warning presented:
[ WARNING ] Git not found - reverting to archived copy

Getting an error "Unable to load the requested class: oauth2"

Hi gang.

I have a fresh version of CI running and I've installed the codeigniter-oauth2 spark via bash on my Ubuntu instances on EC2.

I followed the directions of the documentation and created a controller called auth using the demo code.

I have looked in my sparks folder and all the correct files/folders are there (as well as the /0.4.0 folder).

I have added the Facebook

My autoloads file has this

$autoload['libraries'] = array('session','OAuth2');

Now when I open the page mydomain.com/auth/sessions/facebook I get the error

"Unable to load the requested class: oauth2"

I can't seem to find any other assistance online regarding this issue online. I don't think it's an issue of not having the right case as I have tried all different ways of writing it.

Any direction to fix this issues would be greatly appreciated.

RefreshToken class missing (or How to refresh token)

Hey there, I'm willing to implement refresh token with Google. I've managed to exchange the autorisation token for an access token but can't manage to make it work with refresh token.

From what I see in OAuth 2 provider, the token factory is gonna try to load Token/Refresh.php which doesn't exists.

Am I taking this the wrong way or is this something codeigniter-oauth2 doesn't supports ?

Would love to see a refresh example if possible.

Thanks a lot !

Is there any proper tutorial for this anywhere?

Would love to see one. I'm a total noob to PHP and CodeIgniter (which I wouldn't need to be, if I weren't bootstrapping for my project and had money to hire developers).

I find the stuff a little bit intimidating. The documentation is sparse.

Thank you.

Argument 1 passed to OAuth2\Provider\Facebook::get_user_info() must be an instance of OAuth2\Token\Token_Access

I am using the laravel-oauth2 package for Laravel 4 to set up a Facebook login. I am using the package seen here: https://github.com/madewithlove/laravel-oauth2 (which is based on your repository here).

When running the page that controls the login, the public/oauth/facebook, the Facebook prompt comes up fine, but when I click "accept", the page spits out the following error:

ErrorException
Argument 1 passed to OAuth2\Provider\Facebook::get_user_info() must be an instance of OAuth2\Token\Token_Access, instance of OAuth2\Token_Access given, called in /Applications/MAMP/htdocs/crowdsets/laravel-master/app/controllers/Oauth2Controller.php on line 36 and defined
It is pointing to /­vendor/­taylorotwell/­laravel-oauth2/­src/­OAuth2/­Provider/­Facebook.php: 26

The get_user_info() function in Facebook.php looks like this:

public function get_user_info(Token_Access $token)
{
$url = 'https://graph.facebook.com/me?'.http_build_query(array(
'access_token' => $token->access_token,
));

    $user = json_decode(file_get_contents($url));

    // Create a response from the request
    return array(
        'uid' => $user->id,
        'nickname' => $user->username,
        'name' => $user->name,
        'email' => $user->email,
        'location' => $user->hometown->name,
        'description' => $user->bio,
        'image' => 'https://graph.facebook.com/me/picture?type=normal&access_token='.$token->access_token,
        'urls' => array(
          'Facebook' => $user->link,
        ),
    );
}

My Oauth2Controller.php file looks like this:

'****************', 'secret' => '********************', )); if(! isset($_GET['code'])) { return $provider->authorize(); } else { // Howzit? try { $params = $provider->access($_GET['code']); $token = new Token_Access(array( 'access_token' => $params->access_token )); $user = $provider->get_user_info($token); // Here you should use this information to A) look for a user B) help a new user sign up with existing data. // If you store it all in a cookie and redirect to a registration page this is crazy-simple. echo "
";
        var_dump($user);
    }

    catch (OAuth2_Exception $e)
    {
        show_error('That didnt work: '.$e);
    }
}

}
```

}

I am not sure why it is given me this error, as I followed the documentation and tutorials. Thank you for your help with solving this issue.

Oauth2 library for signing Google Apps domain users

Hi Phil

Could I user your Oauth2 library for allowing (only) users from a google apps domain to login into my Codeigniter application? I mean, in this case I'd need only 1 provider, right?
Will I need a SSL cert.?

Thanks for any clarification you can give me

Required option not passed: access_token

Hi,
I get error when i going to connect linkedin login allow access done. After redirect with access code i got following error message.

An uncaught Exception was encountered

Type: Exception

Message: Required option not passed: access_token

Filename: libraries/Token/Access.php

Line Number: 44

Paypal auth - fatal

Fatal error: Cannot use object of type stdClass as array in libraries\Provider\Paypal.php on line 44

After success login to paypal and go back to the return path I got this error.

Access token request returns 400 error using Instagram provider

I just tried using the Instagram provider to authenticate users in my app and for te most part it works out fine, however when after users grant access to my app and I try to run:

$token = $provider->access($_GET['code']);

I get a 400 Request error, I tried doing the same request via CURL like it says in the Instagram docs:

curl \
    -F 'client_id=CLIENT-ID' \
    -F 'client_secret=CLIENT-SECRET' \
    -F 'grant_type=authorization_code' \
    -F 'redirect_uri=YOUR-REDIRECT-URI' \
    -F 'code=CODE' \
    https://api.instagram.com/oauth/access_token

And it returns the access_token just fine so could it be a problem in how the POST request is beign handled?

Thanks in advance!

Can't make it work with HMVC

The class loads OK but then the class can't load the provider files.

the include in the function class provider (line #28) fails.

Redirect always goes to redirect URI (not the define callback URL)

Hi - The following code in the Provider.php constructor obtains the call URL if the parameter is passed in:
isset($options['callback']) and $this->callback = $options['callback'];

However, a few lines later the redirect URL is set to the URL of the page where the user initiated the auth request:
$this->redirect_uri = site_url(get_instance()->uri->uri_string());

That redirect URL is passed to the provider and the callback URL appears never to be used. Replacing the first line I cited with the below seems to solve the issue. Am I right here?

    $this->redirect_uri = site_url(get_instance()->uri->uri_string()); //this line must be moved up above if statement from below

    if(isset($options['callback']) and $this->callback = $options['callback'])
    {
        $this->redirect_uri = $this->callback;      
    }

Google token is not persistent

Is it possible to make google token persistent so that users don't have to allow the application each time they connect ?

Thanks

Requiered parameters not sent

I've tried to debug the error, but no success for me! Hope you can give me a hand on this issue:

Fatal error: Uncaught exception 'Exception' with message 'Required option not passed: access_token Array ( ) ' in C:\xampp\htdocs\project.com\application\libraries\OAuth2\Token\Access.php:43

Is what I get when I try an session/facebook (Haven't tried any other service)

Calling api using this library in any controller

Hi

How would I call api using this library in any controller. For example if I want to call get_user_info($token) function from Facebook.php provider using different controller and display it on view. Same with the linkedin I want to show user's connection after they login using OAuth.

Any help would be appreciated

Thanks.

Example Usage Error

In your example usage section this line:
$user = $provider->get_user_info($token->access_token);

Should be replaced with this:
$user = $provider->get_user_info($token);

OAuth2_Provider not Found

I just using first time this library, but I have this issue. When I serve the code in Ubuntu it prompts me this error. I have autoloaded libraries.
Fatal error: Class 'OAuth2_Provider' not found in /path-to-libraries/libraries/oauth2/Provider/Facebook.php on line 13

Should I have to consider tu require once?
bests regards

Providers get_user_info() Token Reference

From the main call in the oauth2 class:

$user = $provider->get_user_info($token->access_token);

I have only tested this with Facebook so far but within get_user_info - the initial call with the users access token

$url = 'https://graph.facebook.com/me?'.http_build_query(array(
'access_token' => $token->access_token,
));

Is improperly referencing the token string. Since '$token->access_token' is passed into 'get_user_info' the token is no longer an object but a string.Thus,

$url = 'https://graph.facebook.com/me?'.http_build_query(array(
'access_token' => $token,
));

Allows the token to properly be passed.

Paypal user information

It seems there is no address attribute in $user .
I suggest just 'return $user;' in Paypal.php (line 41).

Github Provider : file_get_content issue

I am trying to use oauth2 with Github api but I am keeping having this message

Message: file_get_contents(https://api.github.com/user?access_token=sometokenhiddenhere): failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden

Filename: Provider/Github.php

Line Number: 32 

Any idea on how to solve that problem ? I tried cURL to but it is giving an empty array. That said when I copy paste the url on the browser I get all the information

Cheers

Suggestion: Making "WindowsLive" get user email, first_name, last_name

here is my code suggestion that works with windowslive Outh to provide user email and name
FILE - libraries/Provider/Windowslive.php
Code

/* at line 49 the return array */
return array(
            'uid'       => $user->id,
            'name'      => $user->name,
            'nickname'  => url_title($user->name, '_', true),
            'first_name' => $user->first_name,
            'last_name' => $user->last_name,
            'email' => $user->emails,
//          'location'  => $user[''], # scope wl.postal_addresses is required
                                          # but won't be implemented by default
            'locale'    => $user->locale,
            'urls'      => array('Windows Live' => $user->link),
        );

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.