Giter Site home page Giter Site logo

Comments (17)

adamwathan avatar adamwathan commented on August 18, 2024

Super bizarre, try dd(OAuth::class) and see what the underlying class is?

from eloquent-oauth-l5.

cillosis avatar cillosis commented on August 18, 2024

Sorry for the delay.

dd(OAuth::class);

Comes back as "OAuth". Although, I tested trying to use that magic constant on arbitrary class names like dd(NonexistantClass::class); and it comes back as "NonexistantClass" so I am not sure how useful that is.

In your service provider (EloquentOAuthServiceProvider), I tried doing dd($this->app['adamwathan.oauth']); at the end of the registerOAuthManager() function and it throws an error about the Reflection class not being able to resolve "hash". It was basically the same issue as this closed ticket: #2

I've spent the last hour and half trying to get to the bottom of it and quite frankly, I have no idea. It might be a symptom of upgrading from 5.0 to 5.1 and the Laravel guide missing something. I've already found a couple weird issues that weren't part of the upgrade docs.

Anyway, great library and if I find something I can do to give back, I will!

from eloquent-oauth-l5.

adamwathan avatar adamwathan commented on August 18, 2024

Hmm weird! Can you by any chance create a minimal Laravel project replicating the issue and throw it up publicly?

from eloquent-oauth-l5.

cillosis avatar cillosis commented on August 18, 2024

I created a brand new Laravel 5.1 app and copied over a little bit of my (small) app logic and re-setup this package. Same issue. But, I think I've narrowed something down. When I do this:

Route::get('{provider}/authorize', function($provider) {
    return OAuth::authorize($provider);
});

I get:

image

But, curiously, when I get the service directly, it works fine:

Route::get('{provider}/authorize', function($provider) {
    return $this->app['adamwathan.oauth']->authorize($provider);
});

So, for some reason it REALLY does not like the OAuth name. I've grep'ed my entire project folder including vendors looking for any conflicts and cannot find any. Also, like I said, if I change the facade alias in config/app.php to something like OAuthSomething it will work fine as well.

I will see about throwing together a fresh dummy install to reproduce the issue.

from eloquent-oauth-l5.

cillosis avatar cillosis commented on August 18, 2024

Ok Adam, I created a new project and loaded the package in. I didn't even have to bother with setting up the database or config settings or anything like that because it never gets that far. I only added the service provider and alias to the app.php config. In the routes file, I did this:

Route::get('/', function () {
    return OAuth::authorize('facebook');
});

And the result is the error from before:

Call to undefined method OAuth::authorize()

https://github.com/cillosis/eloquent-oauth-l5-issue

from eloquent-oauth-l5.

adamwathan avatar adamwathan commented on August 18, 2024

I just cloned that repo, ran composer install, generated an app key and got this error :(

image

Are you using Homestead? This was just running it using the built in PHP server under OSX.

from eloquent-oauth-l5.

cillosis avatar cillosis commented on August 18, 2024

OMG. I think I know why it is doing this. Take a look at this:

http://php.net/manual/en/book.oauth.php

When I tried dd(get_class_methods('OAuth')) it came back with a whole list of methods. I googled some of them and came up with that extension. So, it seems the conflict is not necessarily the package, nor an issue with Laravel, it is global.

For me, doing this dd(extension_loaded('OAuth')); comes back true.

Phew. That took entirely too long to figure out. Might want to either suggest a different name for the facade in the documentation or add a check using extension_loaded() to detect if that is loaded and throw an exception.

from eloquent-oauth-l5.

adamwathan avatar adamwathan commented on August 18, 2024

Ah man that is lame! Ok, I will rename the facade for the next version. It was a shitty name anyways. Thanks for your help!

from eloquent-oauth-l5.

cillosis avatar cillosis commented on August 18, 2024

No, not using homestead -- probably should. I'm just running an install on MacOS from http://php-osx.liip.ch.

from eloquent-oauth-l5.

cillosis avatar cillosis commented on August 18, 2024

Sure man, no problem. Other than that, its super easy to use. Thanks for making this!

from eloquent-oauth-l5.

tankerkiller125 avatar tankerkiller125 commented on August 18, 2024

A temp fix would be to disable the PHP-Oauth plugin (since its Oauth 1.0 and should be depreciated anyways) of course this does pose a problem for shared hosted sites.

from eloquent-oauth-l5.

adamwathan avatar adamwathan commented on August 18, 2024

@tankerkiller125 Just alias it as something else in your config/app.php:

'aliases' => [
    // ...
    'SocialAuth' => 'AdamWathan\EloquentOAuth\Facades\OAuth',
    // ...
]

Or don't alias it at all, and instead import the full use AdamWathan\EloquentOAuth\Facades\OAuth in the classes that need it.

from eloquent-oauth-l5.

skyrpex avatar skyrpex commented on August 18, 2024

SocialAuth looks like a better name than eloquent oauth for this package. Just saying... 👍

from eloquent-oauth-l5.

cillosis avatar cillosis commented on August 18, 2024

That is what I ended up using.

from eloquent-oauth-l5.

adamwathan avatar adamwathan commented on August 18, 2024

@skyrpex Agree, maybe will change down the road...

from eloquent-oauth-l5.

adamwathan avatar adamwathan commented on August 18, 2024

I've updated the installation instructions to use SocialAuth as the facade reference, thankfully doesn't involve changing any code :)

https://github.com/adamwathan/eloquent-oauth-l5/releases/tag/v0.3.1

from eloquent-oauth-l5.

FaisalPlan9 avatar FaisalPlan9 commented on August 18, 2024

[Symfony\Component\Debug\Exception\FatalThrowableError]
Call to undefined method AdamWathan\EloquentOAuth\Facades\OAuth::isDeferred()

from eloquent-oauth-l5.

Related Issues (20)

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.