我对使用 .net Core、API 和外部提供商身份验证完全陌生。
我正在帮助构建一个可在 Autodesk Forge API 上运行的应用程序。
我们希望用户能够使用 OAuth 2.0 以及来自外部身份验证提供商的凭据进行登录。 Google 和 Facebook 等提供商有一个 API,允许开发人员非常轻松地进行设置,但我们似乎找不到使用 Autodesk 凭据执行相同操作的解决方案。
我们已经下载了 AspNet.Security.OAuth.Autodesk nuget 并尝试像 Google 一样设置 Autodesk:
services.AddAuthentication()
.AddAutodesk(autodeskOptions =>
{
autodeskOptions.ClientId = "<our forge app client id>";
autodeskOptions.ClientSecret = "<our forge app client secret>";
})
.AddGoogle(options =>
{
options.ClientId = "<our google id";
options.ClientSecret = "<our google secret>";
});
外部登录所需的其余代码是通用设置的,以便它可以应用于任何/所有提供商。我们已经成功地为相当多的提供商设置了外部登录,但是当我们为 Autodesk 尝试相同的方法时,它会将我们发送到“无效的重定向 uri”。
是否根本无法通过 Autodesk 设置 Oauth 2.0 外部登录选项?或者我们可能做错了什么?
谢谢!
在 Autodesk Platform Services 中注册应用程序期间,您必须配置回调 URL,例如
https://your-awesome-app.com/signin-autodesk
。
有关详细信息,请参阅 https://aps.autodesk.com/en/docs/oauth/v2/tutorials/create-app/#step-2-register-an-app。您可以在 AspNet.Security.OAuth.Providers repo 中找到回调路径