Closed lewis-cobry closed 3 years ago
Solved this with the following code:
Service_.prototype.getApiEndpoint = function() {
if (!this.hasAccess()) {
throw new Error('Access not granted or expired');
}
let token = this.getToken();
try {
return token.api_endpoint;
}
catch {
return null;
}
}
I've been using this library to connect to an API, but now that my app is on the production environment, I need access to the OAuth2 token endpoint's JSON response to retrieve a field called 'api_endpoint' which is returned with the rest of the normal OAuth2 fields.
Having looked at the code, it doesn't seem like I can return the response directly without it being passed into getTokenFromResponse_(), meaning I don't have an opportunity to extract the response in my own code.
Is it currently possible to do this? Thanks :\^)