coryrwest / B2.NET

.NET library for Backblaze's B2 Cloud Storage
MIT License
62 stars 33 forks source link

Application Key for WriteOnly access is not working with File Upload #26

Closed lucwuyts closed 5 years ago

lucwuyts commented 5 years ago

System.AggregateException HResult=0x80131500 Message=Er zijn één of meer fouten opgetreden. Source=mscorlib StackTrace: at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) at System.Threading.Tasks.Task.Wait() at LaundryStatistiek.archiver.Archiveer.Go() in D:\SOFT\Insal\HANDSFREE\BetaalAutomaat\BEZETMELDER_soft\LaundryStatistiek\archiver\Archiveer.cs:line 46 at LaundryStatistiek.Program.Main(String[] args) in D:\SOFT\Insal\HANDSFREE\BetaalAutomaat\BEZETMELDER_soft\LaundryStatistiek\Program.cs:line 33 With a 1 bucket - WriteOnly application key, i have these exceptions Changing the key with an all-access key (write/read,all buckets) everything works.

Inner Exception 1: AuthorizationException: There was an error during authorization. See inner exception for details.

Inner Exception 2: Exception: If you are using an Application key and not a Master key, make sure that you are supplying the Key ID and Key Value for that Application Key. Do not mix your Account ID with your Application Key.

lucwuyts commented 5 years ago

I used AccountId but had to use the KeyId. This is working now.

Maybe change the name for the AccountId parameter in B2Client( ) to AccountOrKeyId

mattwelke commented 5 years ago

@lucwuyts I think around a year ago B2 moved towards a key-oriented system. The idea would be to use a created key instead of the root account key. It might explain why this library might not align perfectly to the API B2 uses right now. Just thought I'd mention it in case you run into other issues.