diff options
author | aunsane <aunsane@gmail.com> | 2017-08-26 12:16:13 +0300 |
---|---|---|
committer | aunsane <aunsane@gmail.com> | 2017-08-26 12:17:09 +0300 |
commit | 5a7a361af0e4a5fe356f457d957b4bae240eb137 (patch) | |
tree | 424d8dd290a35d2c6c67904e07eb36fc208c9b11 /plugins/CloudFile/src | |
parent | bef195fd1b32f62323337a354e6ff019615edc40 (diff) |
CloudFile: fix authorization request with own redirect page
Diffstat (limited to 'plugins/CloudFile/src')
-rw-r--r-- | plugins/CloudFile/src/Services/microsoft_api.h | 7 | ||||
-rw-r--r-- | plugins/CloudFile/src/Services/microsoft_service.cpp | 2 |
2 files changed, 6 insertions, 3 deletions
diff --git a/plugins/CloudFile/src/Services/microsoft_api.h b/plugins/CloudFile/src/Services/microsoft_api.h index cc27a80756..2545708a45 100644 --- a/plugins/CloudFile/src/Services/microsoft_api.h +++ b/plugins/CloudFile/src/Services/microsoft_api.h @@ -7,6 +7,7 @@ namespace OneDriveAPI #define ONEDRIVE_API "https://graph.microsoft.com/v1.0/drive" #define MS_APP_ID "72b87ac7-42eb-4a97-a620-91a7f8d8b5ae" +#include "../../../miranda-private-keys/Microsoft/client_secret.h" class GetAccessTokenRequest : public HttpRequest { @@ -16,8 +17,10 @@ namespace OneDriveAPI { AddHeader("Content-Type", "application/x-www-form-urlencoded"); - CMStringA data = "redirect_uri=https%3A%2F%2Flogin.microsoftonline.com%2Fcommon%2Foauth2%2Fnativeclient"; - data.AppendFormat("&client_id=%s&grant_type=authorization_code&code=%s", MS_APP_ID, code); + CMStringA data = "redirect_uri=https://oauth.miranda-ng.org/verification"; + data.Append("&scope=offline_access https://graph.microsoft.com/files.readWrite"); + data.AppendFormat("&client_id=%s&client_secret=%s", MS_APP_ID, MS_CLIENT_SECRET); + data.AppendFormat("&grant_type=authorization_code&code=%s", code); SetData(data.GetBuffer(), data.GetLength()); } }; diff --git a/plugins/CloudFile/src/Services/microsoft_service.cpp b/plugins/CloudFile/src/Services/microsoft_service.cpp index 194d117df8..9f0cb30c7b 100644 --- a/plugins/CloudFile/src/Services/microsoft_service.cpp +++ b/plugins/CloudFile/src/Services/microsoft_service.cpp @@ -51,7 +51,7 @@ void COneDriveService::Login() return; } - COAuthDlg dlg(this, MS_OAUTH "/authorize?response_type=code&scope=offline_access%20https%3A%2F%2Fgraph.microsoft.com%2Ffiles.readWrite&redirect_uri=https%3A%2F%2Flogin.microsoftonline.com%2Fcommon%2Foauth2%2Fnativeclient&client_id=" MS_APP_ID, RequestAccessTokenThread); + COAuthDlg dlg(this, MS_OAUTH "/authorize?response_type=code&scope=offline_access%20https%3A%2F%2Fgraph.microsoft.com%2Ffiles.readWrite&redirect_uri=https%3A%2F%2Foauth.miranda-ng.org%2Fverification&client_id=" MS_APP_ID, RequestAccessTokenThread); dlg.DoModal(); } |