-
Notifications
You must be signed in to change notification settings - Fork 22
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
Proxy.php line 46 - First parameter must either be an object or the name of an existing class #15
Comments
I have the same issue, please help. |
Okay I have resolved the above error by adding port number to my url in config/app.php , e.g. http://192.0.0.0:8000 can you please help? |
i have same issue. |
did you try to debug it with adding - print_r($data); echo sprintf('%s/oauth/access-token', $config->get('app.url')); die; these lines just above $client = new Client(); this lines, then try that url and parameters with postman or poster or any other rest client ? |
i used
it alerts a message saying something went wrong.
|
@rahul9874563210 |
You will most likely get this error because the Guzzle request was not completed successfully. This happened to me because I did not change the app url in |
I'm stuck on not getting a response too.
Outputting before the
When I use that URL and the parameters in Postman (or even "Advanced Rest Client Application") I oddly get an error The URL I have in config/app.php is |
I'm having a similar issue, I'm passing client_id, client_secret, grant_type, username and password to /oauth/access-token with paw/postman/whichever and receiving back the error Fatal error: Class '\App\User' not found in /vendor/illuminate/auth/EloquentUserProvider.php on line 126 Which is a little odd, so it appears to be failing when retrieving the user after receiving a token... Any ideas? Cheers |
Well, rookie mistake here... Moving the User.php to the App route fixed it. Will update where the model resides later... For what it's worth, I'm using Dingo and my routes look like this $api->version('v1', ['middleware' => 'api.throttle', 'throttle' => 'App\Throttle\GroupThrottle', 'middleware' => 'cors'], function ($api) {
$api->get('/', function() use ($api) {
return view()->make('client');
});
$api->post('login', 'App\\Auth\\Proxy@attemptLogin');
$api->post('refresh-token', 'App\\Auth\\Proxy@attemptRefresh');
$api->post('oauth/access-token', 'LucaDegasperi\\OAuth2Server\\Authorizer@issueAccessToken');
$api->group(['middleware' => 'oauth'], function($api) {
$api->get('resource', function() {
return response()->json([
'id' => 1,
'name' => 'A resource'
]);
});
});
}); I've also removed the optimus oauth2 lumen package and replaced it with I also had to update the oauth2 config file like so: 'grant_types' => [
'password' => [
'class' => '\League\OAuth2\Server\Grant\PasswordGrant',
'callback' => '\App\Grant\PasswordGrantVerifier@verify',
'access_token_ttl' => 3600
],
'refresh_token' => [
'class' => '\League\OAuth2\Server\Grant\RefreshTokenGrant',
'access_token_ttl' => 3600,
'refresh_token_ttl' => 36000
]
], And created a verify function in the PasswordGrantVerifier class: namespace App\Grant;
use Illuminate\Support\Facades\Auth;
class PasswordGrantVerifier
{
public function verify($username, $password) {
$credentials = [
'email' => $username,
'password' => $password,
];
if (Auth::once($credentials)) {
return Auth::user()->id;
}
return false;
}
} Hope this helps someone! |
But still getting the |
At least PAW/Postman works now |
Also, I modified Proxy.php like so (to use the request object): namespace App\Auth;
use GuzzleHttp\Client;
use Illuminate\Http\Request;
class Proxy {
public function attemptLogin(Request $request) {
$credentials = $request->get('credentials');
return $this->proxy('password', $credentials);
} |
Well, it appears I just needed to alter the url for my access-token (as they're being prefixed with api)... Works like a charm now |
@tr33m4n hey man, I'm having the same issue as you did before. When using postman my error is
I tried following everyone's suggestions but I can't seem to make it work. Would it be possible for you to share your lumen folder with the changes you made, to see if I can get this to work? I've been bashing my head against the wall for the past 3 days. Thanks! |
okay everyone, I have already made this working, may be I can help you. @pituseligmann can you please let me know what request you are submitting with postman? |
Hi @sachinvrg , this is the request I'm trying to submit via postman without success: As far as I know, I shouldn't need to pass a access_token parameter at this point. |
@pituseligmann Pitu, did you have any luck fixing your problem at this point? |
Sadly i moved away from Lumen and went right into Laravel since it was so much easier to set up. |
I had the same Problem. I solved it because my route was defined with "access_token" and not "access-token". I changed the route at the Proxy.php to ... $config->get('app.url')."/oauth/access_token" ... Maybe someone has the same issue :) |
Hello All,
Can anybody please help me to sort out this issue, I have tried everything, even downloaded the zip and extract it, but the setup is not working, Is this setup has any bug? could anyone be able to run this setup?
I am getting the same error as almost everyone has -
Proxy.php line 46 - First parameter must either be an object or the name of an existing class
Thank You.
The text was updated successfully, but these errors were encountered: