首页 > 解决方案 > 为什么我收到“invalid_request”?

问题描述

我正在尝试使用 FusionAuth 的无密码登录功能。当我尝试单击收到的电子邮件中的链接时,我收到一个错误“无效的重定向 uri”。我正在使用 php 客户端。

    $request = array();
    $request["applicationId"] = $_SESSION['applicationID'];
    $request["loginId"] = $email;
    $target="http://8615582f3e2c.ngrok.io/index.php/Configure/MyFormEmployees";
    $request["state"]["redirect_uri"] = $target;
    $request["state"]["client_id"]=$_SESSION['applicationID'];
    $request["state"]["response_type"]= "code";
    $request["state"]["scope"]= "openid";
    $request["state"]["state"]= "CSRF123";
    $requestJ = json_encode($request);   //convert the array into json

    $result = $_SESSION['client']->startPasswordlesslogin($requestJ);

这就是我在电子邮件中作为链接收到的内容:http://localhost:9011/oauth2/passwordless/5NHh37raOrUpSO4TlJcL-pY39i1TdasNd9vTTqqaiLk?tenantId=34303566-6466-3234-6565-656233663263&client_id=326488330-de-d-a4-a4- 8ae45c3ca527&redirect_uri=http%3A%2F%2FXX15582f3e2c.ngrok.io%2Findex.php%2FConfigure%2FMyFormEmployees&response_type=code&scope=openid&state=CSRF123

这会导致无效的 URI 错误。我怎样才能让这个链接工作?

标签: fusionauth

解决方案


您需要添加http://XX15582f3e2c.ngrok.io/index.php/Configure/MyFormEmployees到授权重定向 URI 列表。在 FusionAuth 控制台中,请参阅Applications > Edit > OAuth > Authorized redirect URLs.


推荐阅读