我在使用我当前的应用程序实现谷歌登录/注册的HWIOAuthBundle时遇到了问题,该应用程序具有自定义身份验证(不使用FOSUserBundle)。
首先,当我尝试连接到"xxxx/ connect /google“时,我得到了一个404错误。我在哪里可以看到我可以在我的细枝文件中使用的HWIOAuthBundle的列出路径?
登录小枝:
<a href="{{ path('hwi_oauth_service_redirect', {'service' : 'google'}) }}"
class="google-login">Google</a>routing.yml:
google_login:
path: /login/check-google
hwi_oauth_redirect:
resource: "@HWIOAuthBundle/Resources/config/routing/redirect.xml"
prefix: /connect
hwi_oauth_connect:
resource: "@HWIOAuthBundle/Resources/config/routing/connect.xml"
prefix: /connect
hwi_oauth_login:
resource: "@HWIOAuthBundle/Resources/config/routing/login.xml"
prefix: /loginconfig.yml
hwi_oauth:
firewall_names: [main]
resource_owners:
google:
type: google
client_id: ?
client_secret: ?
scope: "email profile"security.yml:
security:
providers:
db_provider:
entity:
class: AppBundle:User
property: email
my_custom_hwi_provider:
id: ib_user.oauth_user_provider
firewalls:
main:
oauth:
resource_owners:
google: "/login/check-google"
login_path: /login
failure_path: /login
oauth_user_provider:
service: ib_user.oauth_user_providerUser.php:
class User extends OAuthUser implements UserInterface {
//added googleId attribute and setters/getter
//also added the "extends OAuthUser"
}OAuthProvider.php也是我添加的一个新类。
发布于 2018-06-07 21:22:41
正如第一条评论所说,调试路由命令是:
php bin/console debug:router一个问题可能是在security.yml中缺少连接的访问控制路径:
access_control:
- { path: ^/connect, role: IS_AUTHENTICATED_ANONYMOUSLY }https://stackoverflow.com/questions/49286384
复制相似问题