我在 github 上创建了一个带有 FeathersJS 后端的 Oauth 流。在本地主机上运行它时一切正常。目前,我正在 EC2 和 EC2 实例上测试到 AWS 的部署,我无法让流程正常工作。我得到了redirect_uri_error。
{
"error": "redirect_uri_mismatch",
"error_description": "The redirect_uri MUST match the registered callback URL for this application.",
"error_uri": "https://developer.github.com/apps/building-integrations/setting-up-and-registering-oauth-apps/troubleshooting-oauth-app-access-token-request-errors/#redirect-uri-mismatch(2)"
}
我认为羽毛会根据配置文件中的参数自动创建重定向 uri。根据 uri 看起来像这样的文档:http(s)://hostname[:port]/auth/<provider>/callback
. 我正在使用以下设置在生产模式下运行该应用程序。我究竟做错了什么?
默认.json:
{
"host": "localhost",
"port": 3030,
"public": "../public/",
"paginate": {
"default": 10,
"max": 50
},
"mongodb": "my_mongo_connection_string",
"authentication": {
"secret": "my_auth_secret",
"strategies": [
"jwt",
"local"
],
"path": "/authentication",
"service": "users",
"jwt": {
"header": {
"type": "access"
},
"audience": "https://example.com",
"subject": "anonymous",
"issuer": "feathers",
"algorithm": "HS256",
"expiresIn": "1d"
},
"local": {
"entity": "user",
"usernameField": "email",
"passwordField": "password"
},
"github": {
"clientID": "my_client_id",
"clientSecret": "my_client_secret",
"successRedirect": "/"
},
"cookie": {
"enabled": true,
"name": "feathers-jwt",
"httpOnly": false,
"secure": false
}
}
}
生产.json
{
"host": "my-ec2-instance.compute.amazonaws.com",
"port": "3030"
}
编辑:将 succesRedirect 更改为“/”