gpt4 book ai didi

java - Spring MVC Apache Oltu 和 Salesforce 集成示例 OAUTH_APPROVAL_ERROR_GENERIC : An unexpected error has occured during authentication

转载 作者:搜寻专家 更新时间:2023-11-01 03:32:25 26 4
gpt4 key购买 nike

我在这里扩展问题:https://stackoverflow.com/questions/46530725/java-io-ioexception-server-returned-http-response-code-411-for-url-https-lo

我正在开发 Spring MVC + Apache Oltu + Salesforce 集成示例。在此示例中,我在 Salesforce 中创建了连接的应用程序,如下所示:

在这个例子中我使用的是:

OAuthBearerClientRequest 请求是什么?与 Github 一样,我使用了 https://api.github.com/user。销售人员的 URL 是什么?

这是从我的代码中调用的:

https://login.salesforce.com/services/oauth2/authorize?scope=full&response_type=code&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Fapache-oltu%2Fsalesforce%2Fredirect&client_id=3MVG9d8..z.hDcPJZPIzGJ5UZDqJOJY.3R6RBM8sJAF8PyTtdTE.DDBnScvPEbcbUmaZ1HQjYItOLpnjY4JHL

但授权中没有任何内容。

例如:OAuthBearerClientRequest

  • Linkedin - https://api.linkedin.com/v1/people/~?oauth2_access_token=
  • Facebook - https://graph.facebook.com/me/friends
  • Github- https://api.github.com/user

销售人员需要什么?

此 URL 也没有我想要的信息:https://developer.salesforce.com/page/Digging_Deeper_into_OAuth_2.0_on_Force.com#Obtaining_an_Access_Token_using_a_SAML_Bearer_Assertion .

enter image description here

enter image description here

我看到的错误:

error=redirect_uri_mismatch&error_description=redirect_uri%20must%20match%20configuration

enter image description here

这里提到的问题: https://issues.apache.org/jira/browse/OLTU-210

最佳答案

我只得到了以下详细信息,仍然希望它能正常工作

了解 OAuth 端点OAuth 端点是您用来向 Salesforce 发出 OAuth 身份验证请求的 URL。

在您的应用程序中发出身份验证请求时,您需要使用正确的 Salesforce OAuth 端点。主要的 OAuth 端点是:

所有端点都需要安全的 HTTP (HTTPS)。每个 OAuth 流程都定义了您需要使用哪些端点以及您需要提供哪些请求数据。如果您在沙盒组织上验证身份验证,请在上面列出的所有 OAuth 端点中使用“test.salesforce.com”而不是“login.salesforce.com”。

当我花了整整 2 周的时间,我得到了以下详细信息作为 URL 的一部分:

http://localhost:8080/apache-oltu/salesforce/redirect#access_token=00D7F0000001I8v%21ARgAQH3Ezr9dXMN2oOwedXsecQOJnNz7fzd8J0b1rv_WGJMLdjntGejARCflNHezO3Jx2EzQ3NCXU5N.9kd3XfIYJsoHuaxo&refresh_token=5Aep8613hy0tHCYdhxJMolioLtSyVWkdY.qjUQIKBDHpKUfFk5dQNWdtRroZqaoeSCMWjemMlechS_MfTRBEYRs&instance_url=https%3A%2F%2Fap5.salesforce.com&id=https%3A%2F%2Flogin.salesforce.com%2Fid%2F00D7F0000001I8vUAE%2F0057F000000l2bgQAA&issued_at=1508009229818&signature=cxOV7F68pvAfoeLZUw1hmZDEx1JKcnFWfpN8dutFPvo%3D&scope=api+web+full+refresh_token&token_type=Bearer

我能够解决问题,现在我也获得了授权代码,它再次获取了 access_tokenrefresh_token

{  
"access_token":"00D7F0000001I8v!ARgAQDvQR1L4XtPVlSzgBQWwN7vi6an6wp2yVa2E.QeCuJFDmWfjU8UKJnZCY0hNHcISEj4u7aHTzTXKPrZwFO7e_2PjilYY",
"refresh_token":"5Aep8613hy0tHCYdhxJMolioLtSyVWkdY.qjUQIKBDHpKUfFk7DxakBkr.fqMfwxgDn5GuOHbU8EWoeGkNma4kJ",
"signature":"KggDhRHjf3/wmU85Cuz5HPriXpvZ7+9nyVMlwFWoizE=",
"scope":"refresh_token api full",
"id_token":"eyJraWQiOiIyMTAiLCJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdF9oYXNoIjoiYmdveG9KR0k4S1BGa1FvVlU1WlNJUSIsInN1YiI6Imh0dHBzOi8vbG9naW4uc2FsZXNmb3JjZS5jb20vaWQvMDBEN0YwMDAwMDAxSTh2VUFFLzAwNTdGMDAwMDAwbDJiZ1FBQSIsImF1ZCI6IjNNVkc5ZDguLnouaERjUEpaUEl6R0o1VVpEckw3Ykp0aEFRX3YwWUN4ekVlRzExSEkxWXdLTmZ2YVlmRHkwbXNKNmF6RTNFQ01COEVHc0YzTlJ0SjAiLCJpc3MiOiJodHRwczovL2xvZ2luLnNhbGVzZm9yY2UuY29tIiwiZXhwIjoxNTA4MDExNDA5LCJpYXQiOjE1MDgwMTEyODl9.gvzr9Eq5QpYmG3s8daf55ey9GP9O2SvBN_3LpmlDB334pS6cLzHZrq6Z-zH6mXmgNAD7OEyVhPVLlsm5Ln2iOPC3AtfFhadyGNHrtbwxG9GtaiCoTwsBQ7dtyx5fytZBQnDrKJ6EoshduJkRDbC9GzuBVjGU0dAluqiC8A_BoX4DJcbCetXwk4bS1MTaf7IJNYceZhsIbgaq1y7CBIwYtlJHLURbrct6hkPFQc65zPAZB6_SZD0uifFRptp52VEelJ0GKC03PvzAgPw2ofaoWkdq5f7pdAZQRpPUDCKcplB3whc4vk0fk5uMacDnJBNNRkds3SjKvx3X0Qg0pE0xm5ISac20WhEYzeDVtqmBeqqVes0ZFIC5t3hewWmrLicCAedaAWuKK5LnpKdhYoClw8Hmtt5y_ewf34TbSuzc6mQ9O6fMNs4nDBr5_20LuPC6Z5rPXb-GKNONAySa8rcLAB4hcRimWBLVMhrKFIcLc2WLYd1OvqgnoKc6gMh76_Ibha0R8veORbusgd9AYJoQEsPed5-LzFrczP0DX-PHD9NGOsT5b2t9daxy8sZ3t_vfo__6GCYG_Lq-Ee0JOEWaemHp6P6a8OTSufQkXiiYdAwe2iSHi1mF457mZhGR9f_IJzUFXzHF8lY8q6LGZI2uLOfFJX4qYFt3Cj6RXbIP4hQ",
"instance_url":"https://ap5.salesforce.com",
"id":"https://login.salesforce.com/id/00D7F0000001I8vUAE/0057F000000l2bgQAA",
"token_type":"Bearer",
"issued_at":"1508011289104"
}

现在我只关心使用 OAuthBearerClientRequest API 到底需要调用什么?

范围引用 URL:https://help.salesforce.com/articleView?id=remoteaccess_oauth_scopes.htm&type=0

我遇到了 OAuthBearerClientRequest API 的问题,不知道为什么。在这里提出了一个问题:Could not access resource: 401 [{"message":"Session expired or invalid","errorCode":"INVALID_SESSION_ID"}] - works only in RestClient plugin .

与我使用 RestTemplate 实现的相同,它工作正常。 enter image description here

关于java - Spring MVC Apache Oltu 和 Salesforce 集成示例 OAUTH_APPROVAL_ERROR_GENERIC : An unexpected error has occured during authentication,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46436388/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com