在我的Symfony2项目中,我需要login
用Salesforce
个用户,因此我安装了HwiOAuthBundle
并在connected app
创建了Salesforce
以获取客户和密钥,但是当我在我的login
应用程序中尝试Symfony2
时,我得到了这个奇怪的错误:
error=redirect_uri_mismatch&error_description=redirect_uri%20must%20match%20configuration
在咨询了许多论坛后,我认为我在Salesforce中遇到了回调网址的问题。
我还有facebook
个配置,可以使用facebook
个用户登录,但它适用于我,但SalesForce
并不适用。
这是salesforce
中所连接应用的配置:
Connected App Name: testApp
Email: my own email
Logo Image URL : i choosed the default one that salesforce provide
Icon URL : same as Logo Image URL
callback url:http://localhost/Annonces/web/app_dev.php/platform/oauth/callback
Selected OAuth Scopes : Full access
和Symfony中的配置: 的 config.yml
hwi_oauth:
firewall_name: main
http_client:
verify_peer: false
resource_owners:
facebook:
type: facebook
client_id: "%oauth.facebook.id%"
client_secret: "%oauth.facebook.secret%"
scope: "email"
salesforce:
type: salesforce
client_id: "%oauth.salesforce.id%"
client_secret: "%oauth.salesforce.secret%"
security.yml
security:
acl:
connection: default
encoders:
OC\UserBundle\Entity\User: sha512
role_hierarchy:
ROLE_USER: ROLE_USER
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH ]
providers:
mine:
id: ib_user.oauth_user_provider
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
pattern: ^/
anonymous: true
oauth:
resource_owners:
facebook: "/login/check-facebook"
salesforce: "/login/check-salesforce"
login_path: /login
failure_path: /login
default_target_path: /platform
oauth_user_provider:
service: ib_user.oauth_user_provider
access_control:
- { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/admin, roles: ROLE_ADMIN }
的routing.yml
oc_platform:
resource: "@OCPlatformBundle/Resources/config/routing.yml"
prefix: /platform
user_logout:
resource: "@OCUserBundle/Resources/config/routing.yml"
prefix: /logout
hwi_oauth_login:
resource: "@HWIOAuthBundle/Resources/config/routing/login.xml"
prefix: /login
hwi_oauth_redirect:
resource: "@HWIOAuthBundle/Resources/config/routing/redirect.xml"
prefix: /connect
facebook_login:
pattern: /login/check-facebook
salesforce_login:
pattern: /login/check-salesforce
答案 0 :(得分:0)
我终于找到了一个解决方案:在connected app
salesforce
中我将callback url
参数设置为:
http://localhost/Annonces/web/app_dev.php/login/check-salesforce
所以我刚刚添加: / login / check-salesforce ,它确实有效。