doudao3170 2014-01-29 09:48
浏览 42

FOSOAuthServerBundle Symfony2身份验证正常工作,但access_token在线被“拒绝”

I'm using Symfony2 with FOSOAuthServerBundle. What I want to do is login with an user over OAuth and make an API call with the retrieved access_token. Therefore the following steps are executed:

1. GET http://localhost/oauth/v2/token?client_id=4_123456&client_secret=123456&grant_type=password&password=PASSWORD&username=USEWRNAME
2. access_token is retrieved and used for the next request
3. GET http://localhost/api2/stats?access_token=ACCESS_TOKEN
4. processing the stats

This is working fine on localhost, but not online! After retrieving an access token via http://test.mydomain.de/oauth/v2/token it is used for the API call http://test.mydomain.de/api2/stats but I get redirected to the login path provided in the security.yml.

The same system and database is used on localhost and online. Are there any differences I should have been taking care of? Any extra settings for online usage, domain settings? Any idea?

security.yml

oauth_authorize:
        pattern:    ^/oauth/v2/auth
        form_login:
            provider: my_fos_facebook_provider
            check_path: _security_check
            login_path: fos_user_security_login
        anonymous: true

    oauth_token:
        pattern:    ^/oauth/v2/token
        security:   false

    api2:
        pattern:    ^/api2
        fos_oauth:  true
        stateless:  true

The client used has the needed grant_type, password and username are correct. I've also tried it with different redirect_uris (

http://localhost/
http://test.mydomain.de

), but is it really necessary? If yes, how should it look like?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥60 求一个简单的网页(标签-安全|关键词-上传)
    • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
    • ¥15 基于卷积神经网络的声纹识别
    • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
    • ¥100 为什么这个恒流源电路不能恒流?
    • ¥15 有偿求跨组件数据流路径图
    • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
    • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
    • ¥15 一直显示正在等待HID—ISP
    • ¥15 Python turtle 画图