无法从Mule消息中提取OAuth访问令牌
我试图在Mule连接器中实现Oauth2,为此我使用Mule Devkit连接器平台的默认方法。但在验证后,由于以下错误,我无法使用令牌。 请帮忙。附带的堆栈跟踪将有所帮助无法从Mule消息中提取OAuth访问令牌,oauth,oauth-2.0,mule,mule-component,Oauth,Oauth 2.0,Mule,Mule Component,我试图在Mule连接器中实现Oauth2,为此我使用Mule Devkit连接器平台的默认方法。但在验证后,由于以下错误,我无法使用令牌。 请帮忙。附带的堆栈跟踪将有所帮助 Root Exception stack trace: java.lang.IllegalArgumentException: OAuth access token could not be extracted from: { "access_token" : "ya29.GlzxA5CJ8FcIay3YXE7sG
Root Exception stack trace:
java.lang.IllegalArgumentException: OAuth access token could not be extracted from: {
"access_token" : "ya29.GlzxA5CJ8FcIay3YXE7sG2spkYYfkcTei6NW_gunsIPW2kSYJToKh1oOyUwkRoy-p-iuGIwLsi5gKvzhZQPMY9wjPkdxR6YJYVswtR3K3iGXlidqbp1_LAQoEHoX0w",
"expires_in" : 3599,
"token_type" : "Bearer"
}
at org.mule.security.oauth.util.DefaultOAuthResponseParser.extractAccessCode(DefaultOAuthResponseParser.java:36)
at org.mule.security.oauth.BaseOAuth2Manager.fetchAndExtract(BaseOAuth2Manager.java:586)
at org.mule.security.oauth.BaseOAuth2Manager.fetchAccessToken(BaseOAuth2Manager.java:432)
at org.mule.modules.drivecon2.adapters.DriveCon2ConnectorOAuth2Adapter.fetchAccessToken(DriveCon2ConnectorOAuth2Adapter.java:207)
at org.mule.security.oauth.processor.OAuth2FetchAccessTokenMessageProcessor.doProcess(OAuth2FetchAccessTokenMessageProcessor.java:68)
at org.mule.devkit.processor.DevkitBasedMessageProcessor.process(DevkitBasedMessageProcessor.java:89)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:108)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44)
at org.mule.processor.BlockingProcessorExecutor.executeNext(BlockingProcessorExecutor.java:88)
at org.mule.processor.BlockingProcessorExecutor.execute(BlockingProcessorExecutor.java:59)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:108)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:108)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44)
at org.mule.processor.BlockingProcessorExecutor.executeNext(BlockingProcessorExecutor.java:88)
at org.mule.processor.BlockingProcessorExecutor.execute(BlockingProcessorExecutor.java:59)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:108)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44)
at org.mule.processor.BlockingProcessorExecutor.executeNext(BlockingProcessorExecutor.java:98)
at org.mule.processor.BlockingProcessorExecutor.execute(BlockingProcessorExecutor.java:59)
at org.mule.interceptor.AbstractEnvelopeInterceptor.processBlocking(AbstractEnvelopeInterceptor.java:58)
at org.mule.processor.AbstractRequestResponseMessageProcessor.process(AbstractRequestResponseMessageProcessor.java:47)
at org.mule.processor.AsyncInterceptingMessageProcessor.processNextTimed(AsyncInterceptingMessageProcessor.java:129)
at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker$1.process(AsyncInterceptingMessageProcessor.java:213)
at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker$1.process(AsyncInterceptingMessageProcessor.java:206)
at org.mule.execution.ExecuteCallbackInterceptor.execute(ExecuteCallbackInterceptor.java:16)
at org.mule.execution.CommitTransactionInterceptor.execute(CommitTransactionInterceptor.java:35)
at org.mule.execution.CommitTransactionInterceptor.execute(CommitTransactionInterceptor.java:22)
at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:30)
at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:14)
at org.mule.execution.BeginAndResolveTransactionInterceptor.execute(BeginAndResolveTransactionInterceptor.java:67)
at org.mule.execution.ResolvePreviousTransactionInterceptor.execute(ResolvePreviousTransactionInterceptor.java:44)
at org.mule.execution.SuspendXaTransactionInterceptor.execute(SuspendXaTransactionInterceptor.java:50)
at org.mule.execution.ValidateTransactionalStateInterceptor.execute(ValidateTransactionalStateInterceptor.java:40)
at org.mule.execution.IsolateCurrentTransactionInterceptor.execute(IsolateCurrentTransactionInterceptor.java:41)
at org.mule.execution.ExternalTransactionInterceptor.execute(ExternalTransactionInterceptor.java:48)
at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:28)
at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:13)
at org.mule.execution.TransactionalErrorHandlingExecutionTemplate.execute(TransactionalErrorHandlingExecutionTemplate.java:110)
at org.mule.execution.TransactionalErrorHandlingExecutionTemplate.execute(TransactionalErrorHandlingExecutionTemplate.java:30)
at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker.doRun(AsyncInterceptingMessageProcessor.java:205)
at org.mule.work.AbstractMuleEventWork.run(AbstractMuleEventWork.java:53)
at org.mule.work.WorkerContext.run(WorkerContext.java:301)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
我发现了错误。
我正确地传递了凭证,但使用了错误的正则表达式。将访问令牌URL更改为低于该值。(用于谷歌身份验证响应。)
我还在为谷歌开发一些OAuth2Mule流,其他的请看我的帖子 要提取令牌,我使用JSON到对象转换器,然后使用#[payload.access_令牌] 我相信令牌检索的正确url是www.googleapis.com:443/oauth2/v4/token,我认为这不起作用,因为存在信任存储问题,我也有accounts.google.com:443/o/oauth2/token在工作,但是后续的api调用需要www.googleapis.com端点,并返回令牌,此时信任问题返回。如果我有兴趣听听你的想法,我会发表评论,但没有足够的分数,很抱歉我的批评
OAuth2(friendlyName = "OAuth 2.0", authorizationUrl =
"https://accounts.google.com/o/oauth2/auth",
accessTokenUrl = "https://accounts.google.com/o/oauth2/token",
accessTokenRegex = "\"access_token\" : \"([^&]+?)\"",
expirationRegex = "\"expires_in\" : ([^&]+?),")