我正在使用HWIOAuthBundle Symfony2 Bundle,并按照本指南中的步骤配置并运行 Bundle,但出现此错误:
error=redirect_uri_mismatch
error_description=The+redirect_uri+MUST+match+the+registered+callback+URL+for+this+application
我如何解决这个问题?
额外信息
hwioauth.yml
(包含在 config.yml 中)
hwi_oauth:
firewall_name: secure
connect:
confirmation: true
resource_owners:
github:
type: github
client_id: "%github_app_id%"
client_secret: "%github_app_secret%"
scope: "user:email"
fosub:
# try 30 times to check if a username is available (foo, foo1, foo2 etc)
username_iterations: 30
# mapping between resource owners (see below) and properties
properties:
github: githubID
路线在routing.yml
#HWIOAuthBundle
hwi_oauth_redirect:
resource: "@HWIOAuthBundle/Resources/config/routing/redirect.xml"
prefix: /secure/connect
hwi_oauth_login:
resource: "@HWIOAuthBundle/Resources/config/routing/login.xml"
prefix: /secure/connect
hwi_oauth_connect:
resource: "@HWIOAuthBundle/Resources/config/routing/connect.xml"
prefix: /secure/connect
hwi_github_login:
prefix: /secure/check-github
HWIOAuth 部分位于security.yml
secure:
pattern: ^/secure
oauth:
failure_path: /secure/connect
login_path: /secure/connect
check_path: /secure/connect
provider: fos_userbundle
resource_owners:
github: "/secure/check-github"
oauth_user_provider:
service: hwi_oauth.user.provider.fosub_bridge
anonymous: true
logout:
path: /secure/logout
target: /secure/connect #where to go after logout
access_control:
- { path: ^/secure/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/secure/connect, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/secure, roles: ROLE_USER