In my Symfony2 project i need to login
with Salesforce
users so i installed HwiOAuthBundle
and i created a connected app
in Salesforce
to get the customer and secret key, but when i try to login
in my Symfony2
application i get this strange error:
error=redirect_uri_mismatch&error_description=redirect_uri%20must%20match%20configuration
after consulting many forums i think that i have problem with callback url in Salesforce.
i have also the facebook
configuration to login with facebook
users and it works for me but with SalesForce
it doesn't.
This the configuration of the connected app in 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
and the configuration in 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