Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix OneDriveGraphApi when use custom redirect url error. #20

Merged
merged 1 commit into from
Oct 27, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Api/OneDriveGraphApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ public class OneDriveGraphApi : OneDriveApi
/// Instantiates a new instance of the Graph API
/// </summary>
/// <param name="applicationId">Microsoft Application ID to use to connect</param>
public OneDriveGraphApi(string applicationId) : base(applicationId, null)
/// <param name="clientSecret">Microsoft Application secret to use to connect</param>
public OneDriveGraphApi(string applicationId, string clientSecret = null) : base(applicationId, clientSecret)
{
OneDriveApiBaseUrl = GraphApiBaseUrl + "me/";
}
Expand Down Expand Up @@ -112,6 +113,8 @@ protected async Task<OneDriveAccessToken> GetAccessTokenFromAuthorizationToken(s
queryBuilder.Add("code", authorizationToken);
queryBuilder.Add("redirect_uri", AuthenticationRedirectUrl);
queryBuilder.Add("grant_type", "authorization_code");
if (ClientSecret != null)
queryBuilder.Add("client_secret", ClientSecret);
return await PostToTokenEndPoint(queryBuilder);
}

Expand Down Expand Up @@ -142,6 +145,8 @@ protected async Task<OneDriveAccessToken> GetAccessTokenFromRefreshToken(string
queryBuilder.Add("refresh_token", refreshToken);
queryBuilder.Add("redirect_uri", AuthenticationRedirectUrl);
queryBuilder.Add("grant_type", "refresh_token");
if (ClientSecret != null)
queryBuilder.Add("client_secret", ClientSecret);
return await PostToTokenEndPoint(queryBuilder);
}

Expand Down