Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Problems with authentication on Twitter #51

Open
navexor opened this issue Mar 4, 2013 · 1 comment
Open

Problems with authentication on Twitter #51

navexor opened this issue Mar 4, 2013 · 1 comment

Comments

@navexor
Copy link

navexor commented Mar 4, 2013

Hi.
I have an issue related with wrong work with sessions. I'll try to explain
I have done all in FOSTwitterBundle readme instruction.
My config.yml is

services:
    my.twitter.user:
        class: Social\TwitterBundle\Security\User\Provider\TwitterUserProvider
        arguments:
            twitter_oauth: "@fos_twitter.api"
            userManager: "@fos_user.user_manager"
            validator: "@validator"
            session: "@session"
            logger: "@logger"

fos_user:
    db_driver: mongodb
    firewall_name: public
    user_class: Social\TwitterBundle\Document\User

fos_twitter:
    file: %kernel.root_dir%/../vendor/kertz/twitteroauth/twitteroauth/twitteroauth.php
    consumer_key: ___
    consumer_secret: ___
    callback_url: http://symfony.local/app_dev.php/mytest/checkTwitter

have a next security.yml config

providers:
    chainprovider:
        chain:
            providers: [fos_twitter, fos_userbundle]

    fos_twitter:
        id: my.twitter.user

    fos_userbundle:
        id: fos_user.user_manager
firewalls:
    dev:
        pattern:  ^/(_(profiler|wdt)|css|images|js)/
        security: false

    admin:
        pattern:      /admin(.*)
        context:        user
        form_login:
            provider:       fos_userbundle
            login_path:     /admin/login
            use_forward:    false
            check_path:     /admin/login_check
            failure_path:   null
        logout:
            path:           /admin/logout
        anonymous:    true

    public:
        pattern:  /mytest
        context:  user
        fos_twitter:
            login_path: connect_twitter
            check_path: check_twitter
            default_target_path: mytest
            provider: fos_twitter

        anonymous: ~

So symptoms is next :

When I redirected to connect_twitter route and enter twitter username|pass and return back to main action - i have no token in session. Also i noticed that new session was started (not the same as before authenticate on twitter side).

Another problem is : I did clear all session files on webserver and clear all cookies. And after redirect to twitter side for authentication - i see twitter dialog twice. Looks like one authentication process operate with 2 different sessions.

Can you help me to find the problem, or give a clue in what direction to look for the problem?

Thanks

@jperazzo
Copy link

Hi, I have a similar problem a while ago.

Have you tried adding this parameter in your security.yml:

use_twitter_anywhere: false

...so your block would look something like this:

public:
        pattern:  /mytest
        context:  user
        fos_twitter:
            login_path: connect_twitter
            check_path: check_twitter
            default_target_path: mytest
            provider: fos_twitter
            use_twitter_anywhere: false

Was this helpful?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants