signature verification failed; please verify account number and chain-id: unauthorized - c#

You don't want to know how many hours I've spent trying to figure this one out.
I'm trying to send a broadcast to the Cosmos Blockchain, via the Terra Pisco/Rebel1 Api.
LUNA2: https://pisco-lcd.terra.dev/swagger/#/
LUNC: https://rebel1.grouptwo.org/swagger/#/
When I run the simulation Api, the transaction works perfectly.
However when I run a transaction just via the standard api, it fails with a "signature verification failed" error.
This issue is related to the signature being passed to Cosmos not containing the correct Chain-Id or Sequence Number. However I've confirmed that the base64 has it. And all the payloads being sent are correct (Protobuf & Rest JSON), according to the Cosmos SDK support team.
I have generated an issue in the cosmos-sdk repo below (it contains all the details, models, dtos, protos, I pass cosmos):
https://github.com/cosmos/cosmos-sdk/issues/14789
I've verified the Protobuf data according to terra-money's terra.js library
https://github.com/terra-money/terra.js. And the data looks correct.
I've also confirmed that the signature contains the correct Chain-Id & Sequence number.
This issue is related to the C# SDK that I'm currently building. It allows users to broadcast Tx data to Terra (Cosmos).
Here's the link, if you want to generate a PR:
https://github.com/TerraMystics/terra-sharp

Related

How to retrieve a payment method on the client side?

We are running an App with a Angular/Typescript frontend and a .NET backend, using Stripe Elements and Stripe.NET respectively.
We are currently using the "Sources" API.
The frontend can create sources, the backend saves them to our specific users. When you open the frontend again, the backend sends a list of source ids. The frontend then collects the data it needs to display those sources directly from Stripe so the user can pick one of his saved sources to pay and does not have to enter all the data again.
Enter the Payment Method / Payment Intend API.
Due to EU regulations Stripe has a new API that requires us to create cards no longer as "source" but as a "PaymentMethod". So I implemented that in the backend, opened the frontend in my IDE, updated the #types/stripe-v3 package and found the new payment intent API.
The only thing missing: I cannot figure out how the frontend is to access the payment method data, once created. I can create it. Send it to the backend. The backend can retrieve it. Send back the ID to the frontend... and now what? How to display the payment methods available?
I had expected a stripe.retrievePaymentMethod() as there is a stripe.retrieveSource(). But no such luck.
The only option I currently see to present the user with a list of existing payment methods is getting this info on the backend and piping it all, class by class, property by property to the client. Basically copying every single data class stripe has into our own backend REST definition. That cannot be right.
What am I missing? Why is there no stripe.retrievePaymentMethod() on the frontend? Did I not understand some fundamental facts about what those APIs should do?
After contacting Stripe directly, it was confirmed that that's just the way it is:
I think it's just an oversight that we didn't add one.
There are similar functions in the mobile SDK so I don't see why we shouldn't have it
There are no immediate plans to add the functionality back in in the very near future,
so as a workaround, I will tunnel all the data through our backend(s).
If I understand as well, I think your problem is following and the sequence of that. I hope this helps you.
I have implemented a payment gateway like ccAvenue with DotNet and angular, in my case, I send the data to the server, and from the server, I tried to redirect to the payment gateway, but APIs return some result, and the result can not be redirected.
So I created a web-form with implementation, I redirected my app to web-forms page and from there I called the ccAvenue page, and in the response URL, I send the response page of webforms only and after saving the response I redirected to my angular app.
Here is workaround if you want to process 3Dsecure cards and still support other methods like SEPA.
You could attach both, confirmed PaymentIntent (payment method) or Source to the Customer object.
On your frontend you could implement both (StripeElements with client secret for 3Dsecure cards) and IBAN element for SEPA.
I could provide my code example how I save payment intent to the customer. It's in PHP, but for other languages logic should be the same.
Assuming that our client already confirmed PaymentIntent and we have it's id:
$intent = \Stripe\PaymentIntent::retrieve($stripe_intent_id);
$payment_method = \Stripe\PaymentMethod::retrieve($intent->payment_method);
$stripe_customer = Stripe\Customer::create([
'payment_method' => $intent->payment_method,
]);
In case you've already created Customer object before you could use attach method:
$payment_method->attach(['customer' => 'cus_FTkGe4lv5LfyI0']);
Then you'll be able to charge using Customer object PaymentMethod or Source;
I didn't try to attach both methods to the same customer object (we only allow customer to have one payment option at the same time), but it should work. Let me know if it works for you.

E00114 Invalid OTS Token while creating subscription with payment nonce using accept JS in Authorize.net

I am building an application using accept js and C# SDK of authorize.net. here, i am using accept js token to make a credit card payment over authorize.net and able to create transaction and customer profile successfully. but when i tried to create a subscription with customer profile id and payment profile id, i got "E00040 Record Not Found" error response.
I also tried to create subscription with another token after creating transaction but getting "E00114 Invalid OTS Token" error response.
What would cause authorize.net to return an these errors?
Looking forward for your quick response.
I was having this problem today, although I was doing PHP on the backend instead of C#. I called into their tech support and here's what I found:
Their production endpoints are actually pretty overloaded on server resources compared to their sandbox unfortunately, at least as of Aug, 2018. This can lead to this misleading Invalid OTS Token error, which can also have several other causes. The tech explained to me that if you have a submit button on the payment form that generates the token and then immediately submits the transaction, that you should add some kind of sleep call (on PHP, that's sleep(5);, for instance). We tried and got it to work on 4 seconds, minimum, but only intermittently. He told me if it fails after a 4 or 5 second sleep call, to reattempt that call one more time after waiting another 2 seconds, before you give up and recommend the customer call your call center or use your other support channels.
In the sandbox, they won't care if you're not using the cert.pem file in your transactions. Not so in production -- you need to ensure you've got that loaded. You can get that file off of Github if you search on the official Authorize.Net files.

AuthBot with Azure Table Store

I'm using authbot (AuthBot) to login users on my bot, but, I'm using a large amount of data, and since than, it starts gives me an error that I'm overload (Stackoverflow)
So, I do as suggested, I create an Azure Table Storage, since than, my bot does not recognize the authentication. It seems Authbot cannot get \ set the data from table storage. Do you know something about it?
The current AuthBot uses the default state client. I've submitted a PR to fix this: https://github.com/MicrosoftDX/AuthBot/pull/37/files
In the interim, you can download the AuthBot source and include the changes to OAuthCallbackController in your project.
Edit:
This repo will eventually replace AuthBot: https://github.com/richdizz/BotAuth It is already using the correct state client interfaces.

Twitter Integration with OAuth with asp.net

I have been trying to establishing an integration with twitter, what i need is just below features.
I should be able to extract all the tweets for my account and display it in my application.
I should be able to post status when i enter a text in my textbox and click on submit.
I have tried multiple ways, even used 3rd party Libraries like TweetSharp(it worked pretty well.) As i need to deliver this to a client, i dont want to use any third party tools, as there will be no one to support in case of any issues.
First think it should be completely free. So i have tried using OAuth as explained in the below link. i have updated the twitter api version to 1.1 and added my Consumer Key, Secret, AccessToken and Secret. I executed the application. To my surprise, my message was posted on to the twitter. but when i changed the status and executed again, it stopped working and it keep gives my un authorized error.
The example i m following might not be the complete one, may be i need to regenerate a access key and do something else. I m confused. can you please help me how i can proceed further and with link to any post with complete code.
http://www.codeproject.com/Articles/247336/Twitter-OAuth-authentication-using-Net
Thank you.
Every status must be unique, or you'll receive an error. For this reason, I append the date/time to the end of the tweet when testing.
BTW, if you ever change your mind about 3rd party libraries, check out LINQ to Twitter.
Just for Info:
New API is more strict while sending headers and creating Signature.
Make sure you fulfill these requirements:
Header values should be in sorted order(lexicographically)
GET Request:
Header should not include any querystring values.
Signature base should contain all values including querystring values
POST Reqeust:
Header should include post parameter values.
Signature base should contain all values including parameter values
Post request Url should append all prameter values in QueryString and requst should be sent to that
This should solve most authorization issues.

RESTful APIs for Azure Analytic Services not working

Alright, I'll be straightfoward here. I successfully called Windows Azure Analytic Services's REST APIs for getting and setting the settings for Blob logging and metrics.
However, when I give it a go for tables and queues, I get the following error message:
AuthenticationFailed Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. RequestId:9d4436e0-9367-46ed-9967-b3ebe888d2f8 Time:2012-01-16T09:20:09.5141262Z
The string I use to sign is the following:
GET\n\n\n\n\n\n\n\n\n\n\n\nx-ms-date:Mon, 16 Jan 2012 09:04:50 GMT\nx-ms-version:2011-0818\n/<accountname>/\ncomp:properties\nrestype:service. It works perfectly fine for Blobs.
The most troublesome thing is that I am not getting an AuthenticationErrorDetail in my response from Analytic Services. When I tried calling the settings REST APIs for Blobs, I actually got a AuthenticationErrorDetail that told me what string the server used to sign. That really helped me construct the above.
Has anyone else gone through something similar?
I realised that my REST calls worked for queues too. It did not work for tables, however.
http://msdn.microsoft.com/en-us/library/windowsazure/dd179428.aspx offered more information:
2009-09-19 Shared Key Lite and Table Service Format
This format supports Shared Key and Shared Key Lite for all versions
of the Table service, and Shared Key Lite for the 2009-09-19 version
of the Blob and Queue services. This format is identical to that used
with previous versions of the storage services. Construct the
CanonicalizedResource string in this format as follows:
Beginning with an empty string (""), append a forward slash (/),
followed by the name of the account that owns the resource being
accessed.
Append the resource's encoded URI path. If the request URI addresses a
component of the resource, append the appropriate query string. The
query string should include the question mark and the comp parameter
(for example, ?comp=metadata). No other parameters should be included
on the query string.
In the end, it accepted the path ?comp=properties.
I encountered similar problems - blobs working fine, tables not working - when I incorrectly used DateTime.Now instead of DateTime.UtcNow for x-ms-date header

Categories

Resources