Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A third party application may be attempting to make unauthorized access to your account - Ameritrade

I was trying to do some simple authorization for ameritrade's developer platform. I was attempting.

According to the platform, the Endpoint I need to access is is: https://auth.tdameritrade.com/auth?response_type=code&redirect_uri={uri}&client_id={client_id}}%40AMER.OAUTHAP

https://developer.tdameritrade.com/content/simple-auth-local-apps

When looking at the client_id, for the dev application, I was noticing that they may actually be referencing the Applications, Consumer Key instead? So i did just that, but when attempting to query the information, it returns: A third-party application may be attempting to make unauthorized access to your account. The reason why i think it is the consumer key, is listed at: https://developer.tdameritrade.com/content/getting-started

So I ended up doing something like:

from urllib.parse import urlencode, quote_plus
url = "https://auth.tdameritrade.com/auth?response_type=code&redirect_uri={uri}&client_id={client_id}}%40AMER.OAUTHAP".format(
  uri=urlencode("http://localhost", quote_via=quote_plus), 
  client_id="JHBDFGJH45OOUDFHGJKSDBNG"  #Sample
  )

I dont think this is because I am currently in a different country currently, I think that something else is wrong here.

It doesnt follow through with it, but instead returns a 400 error with that information. Im not sure whats wrong though.

like image 853
Fallenreaper Avatar asked Dec 24 '19 16:12

Fallenreaper


People also ask

How do I remove account access from a third-party app?

Go to the Security section of your Google Account. Under “Third-party apps with account access,” select Manage third-party access. Select the app or service you want to remove. Select Remove Access. Important: If you remove account access from a third-party app or service, it may retain info you provided from:

How do I find out if a third party has access?

Review what a third party can access You can review the type of account access a third party has as well as the Google services it has access to. Go to the Security section of your Google Account. Under “Third-party apps with account access,” select Manage third-party access.

How do I manage third-party access to my Google account?

Go to the Security section of your Google Account. Under “Third-party apps with account access,” select Manage third-party access. Select the app or service you want to review.

What are third-party sites and apps on Google?

To help you safely share your data, Google lets you give third-party sites and apps access to different parts of your account. Third-party sites and apps are created by companies or developers that aren’t Google. For example, you may download an app that helps you schedule workouts with friends.


4 Answers

This happens when you copied the callback URI incorrectly. Imagine if this were a client application, and TD detected that the application is trying to send the user to a different URL than the app is configured with. If they send the callback request to that application, it will receive the token and gain full control over your account.

Have you double and triple checked that you're copying the callback URL correctly, protocol name, ports, and trailing slashes and everything? Also, consider using an API library instead of writing your own. You can find documentation about this specific error here.

like image 175
alexgolec Avatar answered Oct 18 '22 02:10

alexgolec


I had this issue and I solved it using simply using http://127.0.0.1 on the call back URI of the App.

I then used below URL and it worked as expected.

https://auth.tdameritrade.com/auth?response_type=code&redirect_uri=http%3A%2F%2F127.0.0.1&client_id={MyConsumerKey}%40AMER.OAUTHAP

like image 22
user15119516 Avatar answered Oct 18 '22 00:10

user15119516


Just in case anyone is still having this problem, make sure the callback URI is spelled EXACTLY the same as you specified when creating the app. I was having this problem because I set the callback on the TD developer website to "https://localhost/" and used "https://localhost" in the URL instead (missing the slash at the end). As soon as I added the slash at the end, it worked.

like image 20
Nate Boxer Avatar answered Oct 18 '22 02:10

Nate Boxer


I found out that the issue is caused by the way the callback URL is set. It have to be exactly the same as the callback URL you have typed in at the apps details on the TD developer API page. I tried several permutations and indeed to get the authorization to work both have to be the same. eg. https or http.. end with '/' or does not, it matters. There is also no need to URL encode it.

like image 1
gobassky Avatar answered Oct 18 '22 02:10

gobassky