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 做个有关计算的小程序
  • ¥15 MPI读取tif文件无法正常给各进程分配路径
  • ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
  • ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下
  • ¥15 setInterval 页面闪烁,怎么解决
  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化