This project is read-only.

The gived credentials or configuration format does not fits to the storage provider

Dec 14, 2014 at 7:49 PM
Edited Dec 14, 2014 at 7:50 PM
Hello everyone I am new to cloud storage , I came up with this error "The gived credentials or configuration format does not fits to the storage provider" when I tried to read a txt file with token (uploadMe sub).Looking forward for your reply
My Code :
Dim ConsumerKey As String = "******************"
Dim ConsumerSecret As String = "*****************"
Dim config As DropBoxConfiguration = DropBoxConfiguration.GetStandardConfiguration()
Dim requestToken As DropBoxRequestToken

  Private Sub AuthorizeMe()
    config.AuthorizationCallBack = New Uri("http://www.google.com")
    requestToken = DropBoxStorageProviderTools.GetDropBoxRequestToken(config, ConsumerKey, ConsumerSecret)
    Dim AuthorizationUrl As String = DropBoxStorageProviderTools.GetDropBoxAuthorizationUrl(config, requestToken)
    Process.Start(AuthorizationUrl)
End Sub

   Private Sub saveMyAuth()
    Dim accessToken As ICloudStorageAccessToken = DropBoxStorageProviderTools.ExchangeDropBoxRequestTokenIntoAccessToken(config, ConsumerKey, ConsumerSecret, requestToken)
    Dim DropboxStorage As New CloudStorage()
    DropboxStorage.Open(config, accessToken)

    Dim File As FileStream = New FileStream("c:\TEMP\MyToken.txt", FileMode.Create, System.IO.FileAccess.Write)
    DropboxStorage.SerializeSecurityTokenToStream(requestToken, File)
    File.Close()
End Sub

Private Sub uploadme()
    Try
        Dim configio As DropBoxConfiguration = CloudStorage.GetCloudConfigurationEasy(nSupportedCloudConfigurations.DropBox)
        Dim DropboxStorage As New CloudStorage()
        Dim accessToken As ICloudStorageAccessToken
         Using fs = File.Open("C:\TEMP\MyToken.txt", FileMode.Open, FileAccess.Read, FileShare.None)

            accessToken = DropboxStorage.DeserializeSecurityToken(fs)
        End Using
        DropboxStorage.Open(configio, accessToken)
        Dim srcFile = Environment.ExpandEnvironmentVariables("C:\TEMP\mysqlbackup.xml")
        DropboxStorage.UploadFile(srcFile, "/")
        DropboxStorage.Close()
    Catch ex As Exception
        Console.Beep()
        Console.Write(ex.Message, "")
    End Try
End Sub