“获得具有授权码授予的三腿令牌";产生错误400 [英] "Get a 3-Legged Token with Authorization Code Grant" generates an Error 400

查看:121
本文介绍了“获得具有授权码授予的三腿令牌";产生错误400的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个实现"获得具有授权码授予的三腿令牌"过程.但是,当我运行它时,我得到一个错误:错误:400-无效的redirect_uri

I am trying to create a webpage that implements Step 1 of the "Get a 3-Legged Token with Authorization Code Grant" process described in Autodesk's Forge tutorial. But when I run it I get an error: Error : 400 - Invalid redirect_uri

这是我的代码:

    <!DOCTYPE html> 
    <html lang="en"> 
    <head>
    <title>Get_a_3-Legged_Token_with_Authorization_Code_Grant.php</title>
    </head> 
    <body> 
    <?php 
    // Derivedfrom API tutorial here: 
    // https://developer.autodesk.com/en/docs/oauth/v2/tutorials/get-3-legged-token/

    $client_id                          = "HAqDtKO7VbuRgH0nL0MFJ0B02ElBEK3l";
    $forge_Callback_URL_w_query_string  = "http%3A%2F%2prod.sonautics.com/send_scan.php%3Fcmd%3Drefresh";
    $forge_Your_WebSite_URL             = "httpp%3A%2F%2prod.sonautics.com";

    echo    '<a href="https://developer.api.autodesk.com/authentication/v1/authorize?response_type=code'
        .   '&client_id=' . $client_id      
        .   '&redirect_uri=' . forge_Callback_URL_w_query_string    
        .   '&scope=data:read">Click here to grant access to your data!</a>'; ?> 
    </body> 
    </html>

我收到的页面显示:

糟糕

错误:400-无效的redirect_uri

Error : 400 - Invalid redirect_uri

我们在应用程序配置方面遇到问题.

We're experiencing problems with the application configuration.

连接应用程序

请稍后再试.

我上面的代码非常简单:您能帮我确定错误的根源并告诉我如何解决它吗?

My code above is very simple:can you help me identify the source of the error and tell me how to fix it?

推荐答案

redirect_uri参数应与Callback URL匹配,就像您在此处提到的client id的Forge应用中的以下快照一样.请检查它们当前是否不匹配.

The redirect_uri parameter should be matched with the Callback URL like the following snapshot in your Forge app of this client id you mentioned here. Please check if they are mismatched currently.

此外,

建议通过Forge Viewer查看模型的宣誓范围改为使用viewables:read.暴露了具有此范围的令牌后,其他人就可以使用范围data:read来读取存储桶中的模型文件.请检查此公告: https://forge.autodesk.com/blog/new-viewablesread -scope

the oath scope for viewing models via Forge Viewer is recommended to use viewables:read instead. The scope data:read can be used to read your model files in your bucket by others once your token with this scope is exposed. Please check this announcement: https://forge.autodesk.com/blog/new-viewablesread-scope

这篇关于“获得具有授权码授予的三腿令牌";产生错误400的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆