gpt4 book ai didi

Java Spring : OAuth authentication failed: Unknown Error

转载 作者:行者123 更新时间:2023-12-01 22:38:20 26 4
gpt4 key购买 nike

我正在尝试在 Spring 中运行一个示例 OAuth 客户端。当我运行应用程序时,我收到异常:org.springframework.security.oauth.consumer.OAuthRequestFailedException:OAuth身份验证失败:未知错误

异常中没有更多详细信息,我尝试调试代码以查看它在哪里失败,但没有运气。

如何解决此类问题?

以下是应用程序上下文中的身份验证管理器配置:

    <authentication-manager>
<authentication-provider>
<user-service>
<user name="user" password="pass" authorities="ROLE_USER"/>
</user-service>
</authentication-provider>
</authentication-manager>

<oauth:consumer resource-details-service-ref="resourceDetails" oauth-failure-page="/error">
<oauth:url pattern="/person/login" resources="resource"/>
</oauth:consumer>

<beans:bean id="consumerService" class="com.apple.ist.idms.service.impl.PersonServiceImpl">
<beans:property name="personURL" value="${person-details-url}"/>
<beans:property name="consumerTemplate">
<beans:bean class="org.springframework.security.oauth.consumer.client.OAuthRestTemplate">
<beans:constructor-arg ref="resource"/>
</beans:bean>
</beans:property>
</beans:bean>

<beans:bean id="oauthInputs" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<beans:property name="location" value="classpath:apple-idms-oauth-config.properties"/>
</beans:bean>

<oauth:resource-details-service id="resourceDetails">
<oauth:resource id="resource"
key="${consumer-key}"
secret="${consumer-secret}" request-token-url="${request-token-url}"
user-authorization-url="${user-authorization-url}"
access-token-url="${access-token-url}"
request-token-method="${request-token-method}"
access-token-method="${access-token-method}">
</oauth:resource>

最佳答案

检查来源herehere 。有两个地方创建此消息。您似乎错过了 oauth:resource

中的某些内容

关于Java Spring : OAuth authentication failed: Unknown Error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58512355/

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