From 5a7a361af0e4a5fe356f457d957b4bae240eb137 Mon Sep 17 00:00:00 2001 From: aunsane Date: Sat, 26 Aug 2017 12:16:13 +0300 Subject: CloudFile: fix authorization request with own redirect page --- plugins/CloudFile/src/Services/microsoft_api.h | 7 +++++-- plugins/CloudFile/src/Services/microsoft_service.cpp | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'plugins') 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(); } -- cgit v1.2.3