php - facebook and github login HWIOAuthBundle and FOSUserBundle in Symfony2.1 -


i have followed tutotial http://m2mdas.github.io/blog/2013/11/21/integrate-hwioauthbundle-with-fosuserbundle/ make github login work, seems working when clicked login land on github login page, , see 1 user registered on github application in github dashboard. not authencated in symfony. on symfony tool bar on bottom still says anonymous user, plus new row not added table fos_user.

for facebook login, when click on generator login link facebook, gives me error "given url not permitted application configuration.: 1 or more of given urls not allowed app's settings. must match website url or canvas url, or domain must subdomain of 1 of app's domains."

another doubt had in tutorial, in routing.yml says put,

            hwi_github_login:                 pattern: /secure_area/login/check-github 

as there no controller or resource specified, supposed put here controller action path or resource?

config.yml

fos_user: db_driver: orm # other valid values 'mongodb', 'couchdb' , 'propel' firewall_name: main user_class: les\userbundle\entity\user registration: confirmation: enabled: true

hwi_oauth: # name of firewall in bundle active, setting must set firewall_name: secure_area connect: confirmation: true #account_connector: hwi_oauth.user.provider.fosub_bridge #registration_form_handler: hwi_oauth.registration.form.handler.fosub_bridge #registration_form: fos_user.registration.form

resource_owners:     github:         type:                github         client_id:           b625ec98906cc26ad4f1         client_secret:       a3505d93ab1fc6c5a7fa2805c0723bbfddf556a7         scope:               "user:email"     facebook:         type:                facebook         client_id:           331922526960400         client_secret:       9dc32a145a1c6b0b7f5e57a34d174011 fosub:     # try 30 times check if username available (foo, foo1, foo2 etc)     username_iterations: 30      # mapping between resource owners (see below) , properties     properties:         github: githubid         facebook: fbid 

security.yml

security: encoders: fos\userbundle\model\userinterface: sha512

role_hierarchy:     role_client:      role_user     role_resto:       role_client     role_admin:       [ role_user, role_client, role_resto ]     role_super_admin: role_admin  providers:     fos_userbundle:         id: fos_user.user_provider.username  firewalls:     main:                 pattern: ^/                 form_login:                     provider: fos_userbundle                     csrf_provider: form.csrf_provider                 logout:       true                 anonymous:    true      secure_area:                 pattern: ^/secure_area                  oauth:                         failure_path: /secure_area/connect                         login_path: /secure_area/connect                         check_path: /secure_area/connect                         provider: fos_userbundle                         resource_owners:                               github:           "/secure_area/login/check-github"                               facebook:         "/secure_area/login/check-facebook"                         oauth_user_provider:                               service: hwi_oauth.user.provider.fosub_bridge                  anonymous:    true                 logout:                          path:           /secure_area/logout                          target:         / #where go after logout    access_control:      - { path: ^/booking, role: role_client }      - { path: ^/party_calendar, role: role_client }      - { path: ^/restaurant_admin, role: role_resto }       - { path: ^/secure_area/login, role: is_authenticated_anonymously }      - { path: ^/secure_area/connect, role: is_authenticated_anonymously }      - { path: ^/secure_area, role: role_user } 

routing.yml

       fos_user_security:            resource: "@fosuserbundle/resources/config/routing/security.xml"            prefix: /login         fos_user_profile:            resource: "@fosuserbundle/resources/config/routing/profile.xml"            prefix: /profile         fos_user_register:            resource: "@fosuserbundle/resources/config/routing/registration.xml"            prefix: /register         fos_user_resetting:            resource: "@fosuserbundle/resources/config/routing/resetting.xml"            prefix: /resetting         fos_user_change_password:            resource: "@fosuserbundle/resources/config/routing/change_password.xml"            prefix: /profile           hwi_oauth_redirect:            resource: "@hwioauthbundle/resources/config/routing/redirect.xml"            prefix:   /secure_area/connect         hwi_oauth_login:            resource: "@hwioauthbundle/resources/config/routing/login.xml"            prefix:   /secure_area/connect         hwi_oauth_connect:            resource: "@hwioauthbundle/resources/config/routing/connect.xml"            prefix:   /secure_area/connect         hwi_github_login:            pattern: /secure_area/login/check-github            defaults: { _controller: lescouvertsbundle:couverts:index }          hwi_facebook_login:            pattern: /secure_area/login/check-facebook            defaults: { _controller: lescouvertsbundle:couverts:index }         hwi_google_login:            pattern: /secure_area/login/check-google            defaults: { _controller: lescouvertsbundle:couverts:index } 

entity/user.php

       /**         * @orm\entity         * @orm\table(name="fos_user")         */        class user extends baseuser{            /**             * @orm\id             * @orm\column(type="integer")             * @orm\generatedvalue(strategy="auto")             */            protected $id;             /**             * @var string             *             * @orm\column(name="githubid", type="string", nullable=true)             */            private $githubid;              /**             * @var string             *             * @orm\column(name="githubid", type="string", nullable=true)             */            private $fbid;               public function __construct()            {                parent::__construct();                // own logic            }             /**             * id             *             * @return integer              */            public function getid()            {                return $this->id;            }             /**             * @param string $githubid             */            public function setgithubid($githubid)            {                $this->githubid = $githubid;            }             /**             * @return string             */            public function getgithubid()            {                return $this->githubid;            }             /**             * @param string $fbid             */            public function setfbid($fbid)            {                $this->fbid = $fbid;            }             /**             * @return string             */            public function getfbid()            {                return $this->fbid;            }           } 

  1. the error:

    "given url not permitted application configuration.: 1 or more of given urls not allowed app's settings. must match website url or canvas url, or domain must subdomain of 1 of app's domains."

    happens when domain log facebook app not match app domain have set on settings tab of facebook application.

    for instance, if log in "http:/www.yoursite.com", need go , set "yoursite.com" app domain on application.

  2. as far other problem have, not being able insert users in database, please check following guide, not registers, auto-logins user after registration:

    https://gist.github.com/danvbe/4476697


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -