Get a new Access Token using a valid Refresh Token

schwab_auth3_accessToken(appKey, appSecret, refreshToken)

Arguments

appKey

Schwab generated App Key for the registered app.

appSecret

Schwab generated Secret for the registered app.

refreshToken

An existing Refresh Token generated using schwab_auth2_refreshToken. Only pass the refresh_token, not the entire list

Value

Access Token that is valid for 30 minutes. By default it is stored in options.This is a list of objects that also shows when the access token expires

Details

An Access Token is required for the functions within schwabr It serves as a user login to your accounts. The token is valid for 30 minutes and allows the user to place trades, get account information, get order history, pull historical stock prices, etc. A Refresh Token is required to generate an Access Token. schwab_auth2_refreshToken can be used to generate a Refresh Token which stays valid for 7 days. The appKey is generated automatically when an App is registered on the Schwab Developer site. By default, the Access Token is stored into options and will automatically be passed to downstream functions. However, the user can also submit an Access Token manually if multiple tokens are in use (for example: when managing more than one log in.)

DISCLOSURE: This software is in no way affiliated, endorsed, or approved by Schwab or any of its affiliates. It comes with absolutely no warranty and should not be used in actual trading unless the user can read and understand the source code. The functions within this package have been tested under basic scenarios. There may be bugs or issues that could prevent a user from executing trades or canceling trades. It is also possible trades could be submitted in error. The user will use this package at their own risk.

See also

schwab_auth1_loginURL to generate a login url which leads to an authorization code, then use schwab_auth2_refreshToken to generate Refresh Token with the authorization code

Examples

if (FALSE) { # \dontrun{

# A valid Refresh Token can be fed into the function below for a new Access Token
refreshToken = readRDS('/secure/location/')
accessTokenList = schwab_auth3_refreshToken('schwab_APPKey', 'schwab_AppSecret', refreshToken)

} # }