Need help in integration of onedrive with php web application. Currently i have got stuck while performing below operation:-
I am following this "https://docs.microsoft.com/en-us/onedrive/developer/" doc to integrate it.
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.
In authentication process i followed Microsoft Graph -> code flow.
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.
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.