I would like Create an object to store variables which I will use in my web app.
I cannot access the clientId
and clientSecret
from uriGetToken
using this
.
Also I can use the function in mApiGetToken
in token
.
Could you tell me what I'm doing wrong and how to fix it?
$(document).ready(function () {
// General Settings
var mApiSettings = {
clientId: 'aaa',
clientSecret: 'bbb',
token: mApiGetToken(),
uriGetToken: 'https://ccc/oauth/token?grant_type=client_credentials&client_id=' + this.clientId + '&client_secret=' + this.clientSecret
}
console.log(mApiSettings.uriGetToken);
// Get Autheticated, it requires getting a Token from HollyByte
function mApiGetToken() {
$.getJSON(mApiSettings.uriGetToken, processData);
function processData(data) {
mApiSettings.token = data.access_token;
}
//return token;
}
// For Testing
console.log(mApiGetToken());
});