How can I refresh a Cognito access token in a JavaScript application (AngularJS) if the client application does not generate a client secret?
I attempted to use the code snippet below but it resulted in the following error message: {"error":"invalid_client"}
let dt = {
grant_type: "refresh_token",
client_id: "xxxxxxxxx",
redirect_uri: window.location.origin,
refresh_token: "my_refresh_token"
};
$.ajax({
type: 'POST',
url: "https://example.com/oauth2/token",
data: dt,
headers: { 'Content-Type': 'application/x-www-form-urlencoded'},
success: function(data, textStatus, jqXHR) {
console.log("success!!!");
},
error: function (jqXHR, textStatus, errorThrown) {
console.log("error!!!");
}});