public string GetAuthorizationUrl() { DriveRestClient client = new DriveRestClient(AppConstants.GoogleDriveClientId, AppConstants.DropboxClientSecret, googledriveRedirectUrl.ToString()); var url = client.GetPermissionURL(); return(url); }
public string CompleteOAuthFlow(AuthorizationParameters parameters)//AuthorizationParameters parameters) { try { DriveRestClient restClient = new DriveRestClient(AppConstants.GoogleDriveClientId, AppConstants.GoogleDriveClientSecret, googledriveRedirectUrl.ToString()); DriveToken token = restClient.GetTokenfromCode(parameters.Code); Storage.GoogleDrive.Token = token; return("OAuth succeeded"); } catch (Exception ex)// ActiveDirectoryAuthenticationException ex) { return("OAuth failed. " + ex.ToString()); } }
public string SaveAttachment(AttachmentsDemoWeb.Constants.Attachment attachment) { try { DriveRestClient restClient = new DriveRestClient(AppConstants.GoogleDriveClientId, AppConstants.DropboxClientSecret, googledriveRedirectUrl.ToString()); restClient.Token = Storage.GoogleDrive.Token; string uploadText = restClient.UploadFile(attachment.AttachmentName, attachment.AttachmentBytes); return("Uploaded Sucessfully."); } catch (Exception s) { return(s.Message); } //return ""; }