mirror of
https://github.com/abraunegg/onedrive
synced 2026-03-14 14:35:46 +01:00
Merge branch 'master' into fix-issue-3613
This commit is contained in:
commit
1341901f38
1 changed files with 9 additions and 7 deletions
|
|
@ -795,13 +795,15 @@ class OneDriveApi {
|
|||
}
|
||||
|
||||
// match the authorisation code
|
||||
auto c = matchFirst(response, r"(?:[\?&]code=)([\w\d-.]+)");
|
||||
auto c = matchFirst(strip(response), r"(?:[?&]code=)([^&]+)");
|
||||
|
||||
if (c.empty) {
|
||||
addLogEntry("An empty or invalid response uri was entered");
|
||||
return false;
|
||||
}
|
||||
c.popFront(); // skip the whole match
|
||||
redeemToken(c.front);
|
||||
string authCode = decodeComponent(c.front);
|
||||
redeemToken(authCode);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -1256,13 +1258,13 @@ class OneDriveApi {
|
|||
(*headers)["Prefer"] = "Include-Feature=AddToOneDrive";
|
||||
}
|
||||
|
||||
private void redeemToken(char[] authCode) {
|
||||
char[] postData =
|
||||
private void redeemToken(string authCode) {
|
||||
string postData =
|
||||
"client_id=" ~ clientId ~
|
||||
"&redirect_uri=" ~ redirectUrl ~
|
||||
"&code=" ~ authCode ~
|
||||
"&redirect_uri=" ~ encodeComponent(redirectUrl) ~
|
||||
"&code=" ~ encodeComponent(authCode) ~
|
||||
"&grant_type=authorization_code";
|
||||
acquireToken(postData);
|
||||
acquireToken(postData.dup);
|
||||
}
|
||||
|
||||
private void acquireToken(char[] postData) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue