本文介绍了Spring MVC Apache Oltu和Salesforce Integration示例OAUTH_APPROVAL_ERROR_GENERIC:身份验证期间发生了意外错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这里扩展这个问题:



如果有人请告诉我需要代码供参考。





错误我看到::

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


提到的问题在这里:


I am extending the question here: java.io.IOException: Server returned HTTP response code: 411 for URL: https://login.live.com/oauth20_token.srf?code=

I am developing Spring MVC + Apache Oltu + Salesforce Integration example. In this example, I have created connected App in the salesforce as shown below:

In this example I am using below:

What will be the OAuthBearerClientRequest Request ? Like for Github I had used https://api.github.com/user. What will be the URL for the salesforce ?

This is getting called from my code:

but nothing is coming in Authorization.

For ex: OAuthBearerClientRequest for

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

What is for the salesforce ?

This URL also dont have info what I want: https://developer.salesforce.com/page/Digging_Deeper_into_OAuth_2.0_on_Force.com#Obtaining_an_Access_Token_using_a_SAML_Bearer_Assertion.

Please let me know if someone needs code for reference.

The error which I see::

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

The issue mention here: https://issues.apache.org/jira/browse/OLTU-210

解决方案

I only got the below details, still looking to make it working

Understanding OAuth EndpointsOAuth endpoints are the URLs you use to make OAuth authentication requests to Salesforce.

You need to use the correct Salesforce OAuth endpoint when issuing authentication requests in your application. The primary OAuth endpoints are:

All endpoints require secure HTTP (HTTPS). Each OAuth flow defines which endpoints you need to use and what request data you need to provide.If you’re verifying authentication on a sandbox organization, use "test.salesforce.com" instead of "login.salesforce.com" in all the OAuth endpoints listed above.

When I spent all 2 weeks, I got the below details as a part of URL:

I was able to solve the problems and now I am getting the authorizationCode also which again fetches the access_token and refresh_token etc.

{  
   "access_token":"00D7F0000001I8v!ARgAQDvQR1L4XtPVlSzgBQWwN7vi6an6wp2yVa2E.Qe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_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"
}

Now I am only concern about what exactly do I need to call using OAuthBearerClientRequest API ?

Scope Ref URL: https://help.salesforce.com/articleView?id=remoteaccess_oauth_scopes.htm&type=0

I was facing issue with OAuthBearerClientRequest API, dont know why. Raised a question here: Could not access resource: 401 [{"message":"Session expired or invalid","errorCode":"INVALID_SESSION_ID"}] - works only in RestClient plugin .

The same I implemented using the RestTemplate it works fine.

这篇关于Spring MVC Apache Oltu和Salesforce Integration示例OAUTH_APPROVAL_ERROR_GENERIC:身份验证期间发生了意外错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-02 21:12