bmello4688 / TDAmeritradeApi

Unofficial TD Ameritrade CSharp API Library
Apache License 2.0
12 stars 5 forks source link

Problem authenticating #6

Open justSteve opened 2 years ago

justSteve commented 2 years ago

I'm working with a newly created TDA Dev account and hitting a hurdle at Login. The very first run after installing the repo i hit a runtime complaining about the format of the format of the smsnumbersecretquestionphonenumber. Or perhaps that it was null? Haven't been able to reproduce that since.

The GetAuthorizationCode method is able pull an auth code based on my client_id. Fiddler will confirm that. But the submission of the U/N and PW never hits the wire. At least according to Fiddler. Hitting enter in the console on the password prompt just cycles the code back to the while (response.StatusCode != HttpStatusCode.Found) block.

Code execution is never falling down to var json = await GetResponseData(response);

Appreciate your thoughts

bmello4688 commented 2 years ago

Hey Steve,

It sounds like you are on the right path. I web scraped the authorization using fiddler. You can always run fiddler while getting an auth code outside of using the library and then compare how that looks to the library code. In other libraries you have to get the auth code before hand before using the library. I use the sms code option, I’ve never tested alternative ways. Let me know what you find.

Brian

Brian


From: justSteve @.> Sent: Sunday, December 5, 2021 6:52:58 PM To: bmello4688/TDAmeritradeApi @.> Cc: Subscribed @.***> Subject: [bmello4688/TDAmeritradeApi] Problem authenticating (Issue #6)

I'm working with a newly created TDA Dev account and hitting a hurdle at Login. The very first run after installing the repo i hit a runtime complaining about the format of the format of the smsnumbersecretquestionphonenumber. Or perhaps that it was null? Haven't been able to reproduce that since.

The GetAuthorizationCode method is able pull an auth code based on my client_id. Fiddler will confirm that. But the submission of the U/N and PW never hits the wire. At least according to Fiddler. Hitting enter in the console on the password prompt just cycles the code back to the while (response.StatusCode != HttpStatusCode.Found) block.

Code execution is never falling down to var json = await GetResponseData(response);

Appreciate your thoughts

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/bmello4688/TDAmeritradeApi/issues/6, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AB3WTQVQY5YLYJ4ULO4EMTTUPP3NVANCNFSM5JNLJGFQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

justSteve commented 2 years ago

I'm not seeing any SMS option from the tdamerictrade site anywhere. Wonder if that's part of the disconnect?

bmello4688 commented 2 years ago

So Your dev account is definitely linked to your client account. If you log in to tdameritrade.com, there might be something there where you can change your 2FA option. I couldn’t find it anywhere so you might even have to contact support. You will be able to put a cell number in which might fix the problem all together.

Did you try getting the auth code outside of the library code using the authentication FAQ under guides.

Brian


From: justSteve @.> Sent: Monday, December 6, 2021 7:50:26 PM To: bmello4688/TDAmeritradeApi @.> Cc: bmello4688 @.>; Comment @.> Subject: Re: [bmello4688/TDAmeritradeApi] Problem authenticating (Issue #6)

I'm not seeing any SMS option from the tdamerictrade site anywhere. Wonder if that's part of the disconnect?

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/bmello4688/TDAmeritradeApi/issues/6#issuecomment-987449894, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AB3WTQU5UURZO73ACYDD3P3UPVK5FANCNFSM5JNLJGFQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

bmello4688 commented 2 years ago

https://developer.tdameritrade.com/content/authentication-faq

bmello4688 commented 2 years ago

Did you figure out the issue?

justSteve commented 2 years ago

TDA's API tech support is underwhelming. Some progress and back soon with something to add.

justSteve commented 2 years ago

Nope. I'm still hitting an error within the app's code. Entering my credentials (for my end-user - not developer account, right?), I'm hitting this error:

"One or more errors occurred. (Cannot handle form type: smsnumberphonenumber)"

System.AggregateException
  HResult=0x80131500
  Message=One or more errors occurred. (Cannot handle form type: smsnumberphonenumber)
  Source=System.Private.CoreLib
  StackTrace:
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.Wait()
   at TDClientTester.Program.Main(String[] args) in C:\f\TDClientTester\Program.cs:line 55

  This exception was originally thrown at this call stack:
    TDAmeritradeApi.Client.ClientAuthentication.GetNextAuthRequestContent(System.Net.Http.HttpResponseMessage, TDAmeritradeApi.Client.ICredentials) in ClientAuthentication.cs
    [External Code]
    TDAmeritradeApi.Client.ClientAuthentication.GetAuthorizationCode(TDAmeritradeApi.Client.ICredentials) in ClientAuthentication.cs
    [External Code]
    TDAmeritradeApi.Client.BaseApiClient.LogIn(TDAmeritradeApi.Client.ICredentials) in BaseApiClient.cs
    [External Code]
    TDAmeritradeApi.Client.TDAmeritradeClient.LogIn(TDAmeritradeApi.Client.ICredentials) in TDAmeritradeClient.cs

Inner Exception 1:
NotSupportedException: Cannot handle form type: smsnumberphonenumber
bmello4688 commented 2 years ago

Do you use security questions or a text message for 2FA?

Brian

Brian


From: justSteve @.> Sent: Saturday, December 25, 2021 2:47:25 AM To: bmello4688/TDAmeritradeApi @.> Cc: bmello4688 @.>; Comment @.> Subject: Re: [bmello4688/TDAmeritradeApi] Problem authenticating (Issue #6)

Nope. I'm still hitting an error within the app's code. Entering my credentials (for my end-user - not developer account, right), I'm hitting this error:

"One or more errors occurred. (Cannot handle form type: smsnumberphonenumber)"

System.AggregateException HResult=0x80131500 Message=One or more errors occurred. (Cannot handle form type: smsnumberphonenumber) Source=System.Private.CoreLib StackTrace: at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) at System.Threading.Tasks.Task.Wait() at TDClientTester.Program.Main(String[] args) in C:\f\TDClientTester\Program.cs:line 55

This exception was originally thrown at this call stack: TDAmeritradeApi.Client.ClientAuthentication.GetNextAuthRequestContent(System.Net.Http.HttpResponseMessage, TDAmeritradeApi.Client.ICredentials) in ClientAuthentication.cs [External Code] TDAmeritradeApi.Client.ClientAuthentication.GetAuthorizationCode(TDAmeritradeApi.Client.ICredentials) in ClientAuthentication.cs [External Code] TDAmeritradeApi.Client.BaseApiClient.LogIn(TDAmeritradeApi.Client.ICredentials) in BaseApiClient.cs [External Code] TDAmeritradeApi.Client.TDAmeritradeClient.LogIn(TDAmeritradeApi.Client.ICredentials) in TDAmeritradeClient.cs

Inner Exception 1: NotSupportedException: Cannot handle form type: smsnumberphonenumber

— Reply to this email directly, view it on GitHubhttps://github.com/bmello4688/TDAmeritradeApi/issues/6#issuecomment-1000986634, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AB3WTQVTZ6A4TQAJNAUGJC3USVZI3ANCNFSM5JNLJGFQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you commented.Message ID: @.***>

justSteve commented 2 years ago

text. -- it only tosses a challenge weekly or so, not each login. If I enter a non-valid UN/PW combo I don't hit this error so some of the tx logic is working.

pabloarthurrodger commented 2 years ago

Hello, My name is Pablo Arthur. I have exactly the same issue. Has anyone figure it out how to solve the Cannot handle form type: smsnumberphonenumber?

Thanks in Advance,

Pablo

Does the Code handles Oauth Autentication?