Comments (6)
Yay, glad it wasn't a bug on our side :)
Cheers!
from oauth2-client-bundle.
I can confirm that the autoloader setting is correct, according to the composer.json:
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
Maybe, I haven't dumped the composer file, but that should have been done automatically after using the composer install. I will check that later today when I am back home, as well as provide the info about the dump.
from oauth2-client-bundle.
Sorry for the late reply, was a bit busy.
It appears that it was not dumped. It is working now as expected. Thanks for your help 😃
from oauth2-client-bundle.
Thanks for this report!
I see it checks for provider class before throwing exception: if ($this->checkExternalClassExistence && !class_exists($providerClass))
, so if your provider's class exists - you should not see this error. What is your provider class?
from oauth2-client-bundle.
I'm using a custom provider as I use a generic oauth2 server, this is my provider class:
<?php
namespace App\Security\Provider;
use League\OAuth2\Client\Provider\AbstractProvider;
use League\OAuth2\Client\Provider\Exception\IdentityProviderException;
use League\OAuth2\Client\Provider\ResourceOwnerInterface;
use League\OAuth2\Client\Token\AccessToken;
use Psr\Http\Message\ResponseInterface;
class IPSProvider extends AbstractProvider {
/**
* Returns the base URL for authorizing a client.
*
* Eg. https://oauth.service.com/authorize
*
* @return string
*/
public function getBaseAuthorizationUrl() {
return "https:/whatever.com/oauth/authorize.php";
}
/**
* Returns the base URL for requesting an access token.
*
* Eg. https://oauth.service.com/token
*
* @param array $params
* @return string
*/
public function getBaseAccessTokenUrl(array $params) {
return "https://whatever.com/oauth/token.php";
}
/**
* Returns the URL for requesting the resource owner's details.
*
* @param AccessToken $token
* @return string
*/
public function getResourceOwnerDetailsUrl(AccessToken $token) {
return "https://whatever.com/oauth/me.php";
}
/**
* Returns the default scopes used by this provider.
*
* This should only be the scopes that are required to request the details
* of the resource owner, rather than all the available scopes.
*
* @return array
*/
protected function getDefaultScopes() {
return [];
}
/**
* Checks a provider response for errors.
*
* @throws IdentityProviderException
* @param ResponseInterface $response
* @param array|string $data Parsed response data
* @return void
*/
protected function checkResponse(ResponseInterface $response, $data) {
}
/**
* Generates a resource owner object from a successful resource owner
* details request.
*
* @param array $response
* @param AccessToken $token
* @return ResourceOwnerInterface
*/
protected function createResourceOwner(array $response, AccessToken $token) {
}
}
And this is my config:
knpu_oauth2_client:
clients:
# will create service: "knpu.oauth2.client.foo_bar_oauth"
# an instance of: KnpU\OAuth2ClientBundle\Client\OAuth2Client
ips:
type: generic
provider_class: App\Security\Provider\IPSProvider
# optional: a class that extends OAuth2Client
# client_class: Some\Custom\Client
# optional: if your provider has custom constructor options
# provider_options: {}
# now, all the normal options!
client_id: <client_id>
client_secret: <client_secret>
redirect_route: oauth2_connect_ips_check
redirect_params: {}
Could it be possible caused by using symfony 4.1?
from oauth2-client-bundle.
Thanks for providing this info! I don't think the problem with Symfony 4.1. As for me, it looks like Composer autoloader can't find this class. According to your config, your class should have exactly the next path: src/Security/Provider/IPSProvider.php
and in composer.json
you should have this App\
alias as:
{
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
}
Please, could you double check that this is true for you?
It would be great if you may debug actual provider class passed to configureProviderAndClient()
method, you can temporarily add var_dump($providerClass); die;
statements before this line: https://github.com/knpuniversity/oauth2-client-bundle/blob/master/src/DependencyInjection/KnpUOAuth2ClientExtension.php#L224
from oauth2-client-bundle.
Related Issues (20)
- Google and facebook log in not working with Symfony 5.4
- Telegram login not working with custom provider HOT 1
- User is not authenticating after registering with facebook/google.
- Google provider doesn't allow setting prompt option HOT 2
- Allow defining the default scope for all clients
- json_login + GoogleAuthenticator
- How to get the authenticator to protect all routes if not logged in? HOT 1
- Redirection to login page if not authenticated not working HOT 4
- Does anyone know if this is vulnerable to this hack, token switching
- connect client to server type generic
- test
- <script>alert("asd")</script>
- Change examples to use #[Route()] attributes HOT 1
- Error fetching OAuth credentials: "Missing required parameter [code_verifier]. HOT 3
- SaveAuthFailureMessage trait incompatible with symfony 7
- How to use Google login on Symfony which is used on Apache2 Reverse Proxy? HOT 2
- Unable to do functional tests with PHPUnit since upgrading to new auth system
- Update documentation, drop unmaintained Symfony HOT 5
- redirect_uri in redirects' targetUrl not returning https HOT 7
- Demo app: login with github HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from oauth2-client-bundle.