This topic is locked
[SOLVED]  OAuth external Rest API 12/2/2020
ASPRunner.NET General questions
L
louistpm

Hi all!

For the life of me I cannot get a connection to an external api sorted.

I consume several others with api_key, but this one killing me!

sample OAuth here: https://github.com/T...Me/OAuthExample

dev docs here: https://developer.trademe.co.nz/
if I can be pointed in the right direction, it would be great, I am still very much learning.........

I get error 400
Stack Trace:
[ApplicationException: The remote server returned an error: (400) Bad Request.]

runnerDotNet.MVCFunctions.trigger_error(XVar str, XVar code) in e:\DismantlerCatalogs\TradeMeModule\output\include\MVCFunctions.cs:4041

runnerDotNet.DataSourceREST.getListData(Object _param_dc) in e:\DismantlerCatalogs\TradeMeModule\output\Classes\datasource\rest.cs:185

runnerDotNet.DataSourceREST.getCount(Object _param_dc) in e:\DismantlerCatalogs\TradeMeModule\output\Classes\datasource\rest.cs:213

System.Dynamic.UpdateDelegates.UpdateAndExecute2(CallSite site, T0 arg0, T1 arg1) +260

CallSite.Target(Closure , CallSite , Object , XVar ) +216

runnerDotNet.ListPage.calculateRecordCount() in e:\DismantlerCatalogs\TradeMeModule\output\Classes\listpage.cs:2413

runnerDotNet.ListPage.prepareForBuildPage() in e:\DismantlerCatalogs\TradeMeModule\output\Classes\listpage.cs:1780

CallSite.Target(Closure , CallSite , Object ) +96

runnerDotNet.viewController.list() in e:\DismantlerCatalogs\TradeMeModule\output\Controllers\view\list.cs:131

lambdamethod(Closure , ControllerBase , Object[] ) +62

System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +14

System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary2 parameters) +182
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary
2 parameters) +27

System.Web.Mvc.<>cDisplayClass15.<InvokeActionMethodWithFilters>b12() +56

System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func1 continuation) +256
System.Web.Mvc.&lt;&gt;c__DisplayClass17.&lt;InvokeActionMethodWithFilters&gt;b__14() +22
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList
1 filters, ActionDescriptor actionDescriptor, IDictionary2 parameters) +190
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +311
System.Web.Mvc.Controller.ExecuteCore() +105
runnerDotNet.BaseController.ExecuteThread(Object arg) in e:&#092;DismantlerCatalogs&#092;TradeMeModule&#092;output&#092;Controllers&#092;BaseController.cs:45

[AggregateException: One or more errors occurred.]
runnerDotNet.BaseController.ExecuteCore() in e:&#092;DismantlerCatalogs&#092;TradeMeModule&#092;output&#092;Controllers&#092;BaseController.cs:32
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +88
System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10
System.Web.Mvc.&lt;&gt;c__DisplayClassb.&lt;BeginProcessRequest&gt;b__5() +34
System.Web.Mvc.Async.&lt;&gt;c__DisplayClass1.&lt;MakeVoidDelegate&gt;b__0() +16
System.Web.Mvc.Async.&lt;&gt;c__DisplayClass8
1.<BeginSynchronous>b__7(IAsyncResult
) +10

System.Web.Mvc.Async.WrappedAsyncResult`1.End() +50

System.Web.Mvc.<>cDisplayClasse.<EndProcessRequest>bd() +28

System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7

System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +23

System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +59

System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9

System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9849413

System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +50

System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +163

FrankR_ENTA 12/2/2020

I would like to help, and I have some experience with this, but there's no way I can help without:

  • Some basic information on what the API is expecting specifically for your case
  • Screen shots of how you tried to configure the connection.
    With that stack trace alone, I don't have much I can offer at this time.
    Well, I can offer you this: if this is your first time with an oauth connection, you might be better off demonstrating a working connection with Postman or a short Python script, if you know how to do that - Before trying to wire it up in ASPRunner.NET.

L
louistpm 12/2/2020

Hi,
I used OAuth - App for setup.

I can't seem to attach screenshot to post.

I will try to get setup with postman to see what's going on.

From what I can see, they use OAuth 1.0 and if I look at the "custom code" in ASPRunner it looks like the authorization headers don't match with what they are expecting as per

https://developer.trademe.co.nz/api-overview/authentication/example-plaintext-workflow/
I think I might have to get some paid help on this.......

L
louistpm 12/2/2020

Hi,

I tried and failed - need help.

https://developer.trademe.co.nz/api-overview/authentication/
Does anyone know if xlinesoft development hours would take on something like this? <<<<
I'm still in "startup" phase with the application as a whole and have been putting off getting help because of the costs involved.

I'm supposed to demo this and did not consider that the authentication part would kill my timeframe.

admin 12/2/2020

We do not support OAuth 1.0 and while it is possible to add its support a fairly significant amount of coding will be required.
https://www.synopsys.com/blogs/software-security/oauth-2-0-vs-oauth-1-0/

> Google moved away from OAuth 1.0 in April 2012


If you do not have a budget for this task finding another API provider that supports modern authentication options is recommended.

L
louistpm 12/6/2020

Thanks for all the help and advice.

I got it resolved.
|Great forum, great support.