Authorization codes are created when a user authorizes your application for access to their account. You can enable a user to do this by sending them to a specific URL.
Scopes are used to give a level of access control to our customers. When a customer approves access to an application, they will be prompted to approve the scope of your application. The scope is enforced at the access token level and cannot be changed without asking a user to authorize your application again.
|read||Read-only access to account data|
|write||Read/Write access to account data (does not include placing or updating trades)|
|market||Access market data (does not include streaming)|
|trade||Update and place trades|
|stream||Create streaming sessions for use with the Streaming API|
If the user authorizes your application, a call will be made to the callback URL registered with your application. That callback will look something like:
Note: The reason the state is sent back to you is to make sure no-one is tampering with this exchange. If it’s different than the original you should abort the exchange and start over.
If everything checks out, you’ve got an authorization code you can exchange for an access token (Congrats!).
Since this call should be made in a browser, a successful response will be a 302 redirect to Tradier Brokerage’s web site where the user can log in and authorize.
$ curl https://api.tradier.com/v1/oauth/authorize?client_id=098f6bcd4621d373cade4e832627b4f6&scope=read&state=ohai
GET /oauth/authorize?client_id=098f6bcd4621d373cade4e832627b4f6&scope=read&state=ohai HTTP/1.1 Host: api.tradier.com Accept: */*
HTTP/1.1 302 Location: https://brokerage.tradier.com/oauth/authorize?client_id=098f6bcd4621d373cade4e832627b4f6&scope=read&state=ohai Content-Length: 0
Tradier Inc. and its corresponding technology services (including API services) are distinct and separate from the services provided by Tradier Brokerage Inc. For more information regarding the services of Tradier, Inc., please contact firstname.lastname@example.org. For more information regarding the services of Tradier Brokerage, Inc. please contact email@example.com. Tradier Brokerage Inc. Member FINRA/SIPC