Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 83 lines (68 sloc) 3.26 KB
<!doctype html>
<meta charset="utf-8">
<title>OANDA Client-Side OAuth Flow Sample/Demo</title>
<!-- All JavaScript at the bottom, except this Modernizr build.
Modernizr enables HTML5 elements & feature detects for optimal performance.
Create your own custom Modernizr build: -->
<script src=""></script>
<!-- -->
<script src="js/libs/localstorage.js"></script>
<script src="js/libs/modernizr-2.5.3.min.js"></script>
<script src=""></script>
<script src=""></script>
<script type="text/javascript">
function implicitFlow() {
jso_wipe(); // Cleans all saved tokens ... etc
// This dumps all cached tokens to console, for easier debugging.
// Configures the permissions that your application will request.
// Valid values are (currently) "read", "trade", "marketdata", "stream".
// See the OANDA documentation for the latest values and more details.
"oanda": ["read","trade","marketdata", "stream"]
// This function configures your application's OAuth credentials.
"oanda": {
// Specify the client_id that was provided to you from OANDA
client_id: "<client application id>",
// Specify the redirect_URL that you provided to OANDA when you registered your application.
redirect_uri: "<redirect uri>",
// The OANDA authorization URI.
// For fxPractice -> ""
// For fxTrade ->"
authorization: "",
function getAccountInfo() {
// OANDA REST API URI. For demo purposes, this will go to the fxPractice's accounts endpoint
// For fxPractice -> ""
// For fxTrade ->"
url: "",
jso_provider: "oanda",
jso_allowia: true,
jso_scopes: ["read"],
dataType: 'json',
success: function(data) {
console.log("Response (oanda):");
document.write("Currency: " + data.accounts[0].accountCurrency + "<br>");
document.write("AccountId: " + data.accounts[0].accountId + "<br>");
document.write("AccountName: " + data.accounts[0].accountName + "<br>");
<script type=text/javascript>
$(document).ready(function() {
<button type="button" onclick="implicitFlow()">Begin OANDA Client-Side OAuth Flow</button>
<button type="button" onclick="getAccountInfo()">Get Account Information</button>