我正在嘗試將郵遞員配置爲「獲取新訪問令牌」函數,以便在調用資源之前檢索令牌。我使用FOSOAuthServerBundle與郵遞員請求令牌
這是我security.yml
# To get started with security, check out the documentation:
# http://symfony.com/doc/current/security.html
security:
encoders:
FOS\UserBundle\Model\UserInterface: sha512
providers:
fos_userbundle:
id: fos_user.user_provider.username
firewalls:
oauth_token: # Everyone can access the access token URL.
pattern: ^/oauth/v2/token
security: false
api:
pattern: ^/ # All URLs are protected
fos_oauth: true # OAuth2 protected resource
stateless: true # Do no set session cookies
anonymous: false # Anonymous access is not allowed
在窗口,在這裏我把我看到了這條線的認證信息
回調URL https://www.getpostman.com/oauth2/callback 把它設爲您的應用設置頁面中的回叫網址。
theese是身份驗證信息:
Auth URL: https://{{url}}/api/web/app_dev.php/oauth/v2/auth
Access Token URL: https://{{url}}/api/web/app_dev.php/oauth/v2/token
Client ID: {{client_id}}
Client Secret: {{client_secret}}
Grant Type: Client Credentials
其中{{URL}},{{CLIENT_ID}}和{{client_secret}}是郵差的環境變量。
我哪裏錯了?
謝謝。
對不起,我遲到的答案。我收到的消息是 '從client_credentials流獲取訪問令牌時出錯。無法發送請求。「# –
我發現在yout令牌網址'topken'中存在拼寫錯誤,請確保所有值都正確輸入,沒有任何錯誤。 –
謝謝。不,它只是答案中的一個錯字。我很快就會解決的。 –