changed redirect_url to redirect_uri

This commit is contained in:
skilion 2016-03-07 14:34:35 +01:00
parent 89452985ec
commit 880af3ec03

View file

@ -50,13 +50,13 @@ final class OneDriveApi
void authorize() void authorize()
{ {
import std.stdio, std.regex; import std.stdio, std.regex;
string url = authUrl ~ "?client_id=" ~ clientId ~ "&scope=wl.offline_access%20onedrive.readwrite&response_type=code&redirect_url=" ~ redirectUrl; string url = authUrl ~ "?client_id=" ~ clientId ~ "&scope=wl.offline_access%20onedrive.readwrite&response_type=code&redirect_uri=" ~ redirectUrl;
writeln("Authorize this app visiting:\n"); writeln("Authorize this app visiting:\n");
writeln(url, "\n"); writeln(url, "\n");
while (true) { while (true) {
char[] response; char[] response;
write("Enter the response url: "); write("Enter the response uri: ");
readln(response); readln(response);
auto c = matchFirst(response, r"(?:code=)(([\w\d]+-){4}[\w\d]+)"); auto c = matchFirst(response, r"(?:code=)(([\w\d]+-){4}[\w\d]+)");
if (!c.empty) { if (!c.empty) {
@ -183,14 +183,14 @@ final class OneDriveApi
private void redeemToken(const(char)[] authCode) private void redeemToken(const(char)[] authCode)
{ {
string postData = "client_id=" ~ clientId ~ "&redirect_url=" ~ redirectUrl ~ "&client_secret=" ~ clientSecret; string postData = "client_id=" ~ clientId ~ "&redirect_uri=" ~ redirectUrl ~ "&client_secret=" ~ clientSecret;
postData ~= "&code=" ~ authCode ~ "&grant_type=authorization_code"; postData ~= "&code=" ~ authCode ~ "&grant_type=authorization_code";
acquireToken(postData); acquireToken(postData);
} }
private void newToken() private void newToken()
{ {
string postData = "client_id=" ~ clientId ~ "&redirect_url=" ~ redirectUrl ~ "&client_secret=" ~ clientSecret; string postData = "client_id=" ~ clientId ~ "&redirect_uri=" ~ redirectUrl ~ "&client_secret=" ~ clientSecret;
postData ~= "&refresh_token=" ~ refreshToken ~ "&grant_type=refresh_token"; postData ~= "&refresh_token=" ~ refreshToken ~ "&grant_type=refresh_token";
acquireToken(postData); acquireToken(postData);
} }