【发布时间】:2020-08-03 20:37:23
【问题描述】:
我使用 Symfony 5 和 oauth2 捆绑包 trikoder/oauth2-bundle 在 Web 应用程序中构建了一个 oauth2 服务器,以便登录其他客户端站点的用户。当客户端站点激活授权请求时,我收到此错误。我在 Stackoverflow 上阅读了这个问题的答案,但他们回答的是 Laravel 问题,而不是 Symfony 5。 这是 .env 文件:
###> trikoder/oauth2-bundle ###
后备 OAuth2 加密密钥
请用安全值覆盖它:https://oauth2.thephpleague.com/installation/#string-password
OAUTH2_STRING_PASSWORD=4YUuCt##################x2wsEdg
OAUTH2_ENCRYPTION_KEY=def########################################## ###########cbf
这里是 config/packages/trikoder_oauth2.yaml 文件
trikoder_oauth2:
authorization_server:
private_key: /var/oauth/private.key # Change this
private_key_passphrase: null # Passphrase of the private key, if any
encryption_key: '%env(string:OAUTH2_ENCRYPTION_KEY)%' # (Optional) Change this
encryption_key_type: "defuse"
# How long the issued access token should be valid for.
# The value should be a valid interval: http://php.net/manual/en/dateinterval.construct.php#refsect1-dateinterval.construct-parameters
access_token_ttl: PT1H
# How long the issued refresh token should be valid for.
# The value should be a valid interval: http://php.net/manual/en/dateinterval.construct.php#refsect1-dateinterval.construct-parameters
refresh_token_ttl: P1M
# How long the issued auth code should be valid for.
# The value should be a valid interval: http://php.net/manual/en/dateinterval.construct.php#refsect1-dateinterval.construct-parameters
auth_code_ttl: PT10M
resource_server:
public_key: /var/oauth/public.key # Change this
persistence:
doctrine: null
public.key 和 private.key 在 var/auth/ 路径中。 客户端是在 oauth2_client 表中创建的,带有两个参数 identifier 和 secret。 非常感谢您的回复! 阿兰·朱夫
【问题讨论】:
标签: symfony oauth-2.0 private-key