简体   繁体   English

我如何登录到 API 呼叫具有多重身份验证的 Salesforce?

[英]How can i login to Salesforce that has Multi Factor Authentication on API calls?

I have started using MFA in Salesforce. I can successfully configure the setting "Multi-Factor Authentication for User Interface Logins" and use the Salesforce Authenticator app.我已经在 Salesforce 中开始使用 MFA。我可以成功配置设置“用户界面登录的多重身份验证”并使用 Salesforce 身份验证器应用程序。

I have now enabled "Multi-Factor Authentication for API Logins", but in my C# app, the user enters Username, Password and Security Token and我现在已经启用了“API 登录的多重身份验证”,但是在我的 C# 应用程序中,用户输入用户名、密码和安全令牌,然后

I login to Salesforce via the following code:我通过以下代码登录到 Salesforce:

   SFService = new SalesForceEnterpriseService.SforceService() { Timeout = 80000, Url = 
        "https://login.salesforce.com/services/Soap/u/52.0"};                               
   LoginResult  result = SFService.login(Username, Password + Token);

But now i get the error:但现在我得到了错误:

 INVALID_LOGIN: Invalid username, password, security token; or user locked out.

But i assume it is due to the MFA.但我认为这是由于 MFA。

How can i now login a user if MFA is enabled in API logins and will i be able to make other API calls like getting Entity fields?如果在 API 登录中启用了 MFA,我现在如何登录用户,我是否能够进行其他 API 调用,例如获取实体字段?

No, it's not MFA.不,这不是 MFA。 Go to FAQ , search for "API" and it clearly says MFA is not required. Go 到常见问题解答,搜索“API”,它清楚地表明不需要 MFA。

Do you use normal Salesforce username and password or do you have Single Sign On enabled?您使用正常的 Salesforce 用户名和密码还是启用了单点登录? API logins need SF credentials (or you can use an OAuth2 flow where human sees the SSO login page, types passwords there and then is taken back to your app. Entering SSO password directly to your app & logging in with SOAP won't work) API 登录需要 SF 凭据(或者您可以使用 OAuth2 流程,让人们看到 SSO 登录页面,在那里输入密码,然后返回到您的应用程序。直接将 SSO 密码输入到您的应用程序并使用 SOAP 登录将不起作用)

Go to your user's login history and view most recently used IP (and/or go to whatismyip.com). Go 到您用户的登录历史记录并查看最近使用的 IP(和/或 go 到 whatismyip.com)。 Go to Setup -> Network Access and add that IP to trusted ranges. Go 到设置 -> 网络访问并将 IP 添加到受信任的范围。 This will mean you don't need security token anymore.这将意味着您不再需要安全令牌。 Check if just username and password works better, maybe there were typos or it's an old token.检查是否只有用户名和密码效果更好,可能有拼写错误或者是旧令牌。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Windows登录的多因素身份验证 - Multi-factor Authentication for Windows login 如何使用C#将多重身份验证登录到Dynamics 365 - How to login Multi-Factor Authentication to Dynamics 365 using C# salesforce中用于登录的SOAP API - SOAP API in salesforce for login Sharepoint CSOM多因素身份验证 - Sharepoint CSOM Multi Factor Authentication 使用'AADSTS50079登录Azure Web应用程序失败:用户需要使用多重身份验证' - Login to Azure Web Application fails with 'AADSTS50079: The user is required to use multi-factor authentication' 如何在 WinForms 应用程序中使用 Salesforce OAuth 2.0 隐式流身份验证? - How can I use Salesforce OAuth 2.0 implicit flow authentication in a WinForms application? API登录的SalesForce安全性问题 - SalesForce Security issues with the API login 使用Salesforce的MVC OAuth身份验证返回登录页面 - MVC OAuth authentication with Salesforce returns to login page 自定义多因素Active Directory身份验证 - Custom Multi-factor Active Directory Authentication 如何在.NET Web API连接的应用程序中从Salesforce中提取联系人记录 - How Can I Pull The Contacts Records from Salesforce in .NET Web API Connected Application
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM