如果应用程序客户端未生成客户端密钥,如何刷新 javascript 应用程序(AngullarJS)中的认知访问令牌

问题描述 投票:0回答:1

如果应用程序客户端未生成客户端密钥,如何刷新 javascript 应用程序(AngullarJS)中的认知访问令牌?

我尝试使用以下查询,但它返回:{“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!!!");
}});

javascript angularjs oauth-2.0 amazon-cognito access-token
1个回答
0
投票

虽然不应在此请求上发送redirect_uri 参数,但看起来基本没问题。尝试删除它。另请参阅添加作用域参数是否会产生影响(尽管这应该是可选的)。当然要注意仔细验证client_id。

这是我的公共客户端(演示应用程序)的工作帖子。我可以确认这笔赠款在 Cognito 中对公共客户来说效果很好。

refresh

© www.soinside.com 2019 - 2024. All rights reserved.