dongmie3526 2018-07-24 18:38
浏览 125
已采纳

onedrive与php应用程序的集成 - 无效的客户机密钥 - 错误

Need help in integration of onedrive with php web application. Currently i have got stuck while performing below operation:-

  1. I am following this "https://docs.microsoft.com/en-us/onedrive/developer/" doc to integrate it.

  2. First registered my app in "Microsoft Application Registration Portal" through my account "https://login.microsoftonline.com". There it asked few details regarding my application -> redirect url and i generated Client ID and client Secrete which will be needed while using onedrive API.

  3. In authentication process i followed Microsoft Graph -> code flow.

  4. Made API call "GET https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id={client_id}&scope={scope} &response_type=code&redirect_uri={redirect_uri}". Specified the required details and i got proper response. i.e "https://myapp.com/auth-redirect?code=df6aa589-1080-b241-b410-c4dff65dbf7c" from which i got the code.

  5. Now using this code i have to get Access token in which i am failing. So for that i am making API call as mentioned in doc. i.e "POST https://login.microsoftonline.com/common/oauth2/v2.0/token Content-Type: application/x-www-form-urlencoded

    client_id={client_id}&redirect_uri={redirect_uri}&client_secret={client_secret} &code={code}&grant_type=authorization_code"

Above i am passing the same client secrete which i generated while creating the app. But still i am not getting the Access token instead i receive response as:-

{"error":"invalid_client","error_description":"AADSTS70002: Error validating credentials. AADSTS50012: Invalid client secret is provided...}

I tried few other option also like regenerating the new secret key and also urlencoding but was of no use. Please help me out as i am not able to move forward from here. Thanks in advance for help.

  • 写回答

1条回答 默认 最新

  • douti6740 2018-07-27 08:14
    关注

    Figured out the issue. Basically the issue was w.r.t the secret key generated. In the "Microsoft Application Registration Portal" where we register our app, there while generating application secret i was using "Generate New key pair" option to generate the sceret instead we have to use the secret genearted by clicking other option "Generate New Password".

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 使用C#,asp.net读取Excel文件并保存到Oracle数据库
  • ¥15 C# datagridview 单元格显示进度及值
  • ¥15 thinkphp6配合social login单点登录问题
  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配