Here is the code snippet I am working with:
var me = this;
gapi.auth.authorize({ client_id: client, scope: scope, immediate: true }, function (authResult: any) {
if (authResult && !authResult.error) {
me.accessToken = authResult.access_token;
} else {
//TODO : show error in front end
}
});
When I incorporate a callback function like this:
gapi.auth.authorize({ client_id: client, scope: scope, immediate: true }, AuthResult);
function AuthResult(authResult: any) {
if (authResult && !authResult.error) {
me.accessToken = authResult.access_token;
} else {
//TODO : show error in front end
}
I am facing an issue where the "me" property is not accessible within that callback function.
Is there a way to encapsulate the callback function within another callback function so that I can access both "me" and "scope" in JavaScript?