Unsplash-js userAuthentication返回错误“ grant_type未定义”

问题描述

我使用了示例中的代码

        unsplash.auth.userAuthentication(query.code)
      .then(toJson)
      .then(json => {
        unsplash.auth.setBearerToken(json.access_token);
      });

并返回错误401,在其中写入,未定义grant_type。

    {"error":"invalid_request","error_description":"Missing required parameter: grant_type."}

我检查了代码并定义了grant_type

    userAuthentication: function(t) {
                    var n = a.OAUTH_TOKEN_URL;
                    return e.request({
                        url: n,method: "POST",body: {
                            client_id: e._accessKey,client_secret: e._secret,redirect_uri: e._callbackUrl,grant_type: "authorization_code",code: t
                        },oauth: !0
                    })
                },

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)