cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Tell us what you want to see on the Community here!
Close

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

AuthException when already have token

Highlighted

AuthException when already have token

Collaborator | Level 8

Have got authorisation via login working, but am having issues when re-using the token (i.e. bypassing having to login again). I'm getting...

Exception thrown: 'Dropbox.Api.AuthException' in Dropbox.Api.dll
Exception thrown: 'Dropbox.Api.AuthException' in System.Private.CoreLib.dll

...after a DropboxClient(token) call. I've checked, and the token is successfully retrieved and passed on to the DropboxClient call, and the assignment to DropboxClient is succesful (i.e. pointer isn't null, and I can successfully run a .tostring() on it), just when I try to do something useful with the client I get this Auth exception. :-(

I was expecting that re-using a token would work (same as with you normally only have to login to Dropbox once on each device youinstall it on) - is that not the case? If so, I'm not sure why it's not working in this case. I can get around it by logging in every time, but obviously that is quite annoying. Hoping you can help me get this token working more than once?

 

1 Accepted Solution

Accepted Solutions
Highlighted

Re: AuthException when already have token

Collaborator | Level 8

OMG. Unbelievable. I put in a whole bunch of debug writelines, every single time something related happens - when I've got the token, when I've saved it, when I'm retrieving it, every time anything at all happens with the token to try and find where the token is different - and when I ran it, it was working!!!! Same token, start to finish, client call works now. I never touched any actual code, just put in a whole bunch of debug statements, and it's just decided to start working. ARGH! Hair-tearing frustration, and it just decides to start working just like that.

(sigh) Well, at least now it's working. Thanks for your time Greg. Hopefully have some smooth sailing from here (though the fact that it just started working without me changing any actual code is worrying that it may just stop working again)...

View solution in original post

4 Replies 4
Highlighted

Re: AuthException when already have token

Dropboxer

Dropbox API access tokens currently don't expire automatically, so you should be able to store and re-use them like this. Note that they can be revoked by the user or app at any time though.

Can you inspect the AuthException you're getting? It inherits from StructuredException<AuthError>. The AuthError should more specifically indicate the reason for the failure.

Highlighted

Re: AuthException when already have token

Collaborator | Level 8

Thanks Greg for confirming the token should would the way one would expect.

It took a bit of effort, but finally managed to get some more info out of it. It says "invalid_access_token/..." - not sure why it would be invalid?

Highlighted

Re: AuthException when already have token

Collaborator | Level 8

Leave this with me for the moment. For some reason I'm getting a different token when I get it from settings. Need to step through this and try and find how that is happenning. Will let you know how I go (now that I've finally found why it was telling me it was invalid!).

Highlighted

Re: AuthException when already have token

Collaborator | Level 8

OMG. Unbelievable. I put in a whole bunch of debug writelines, every single time something related happens - when I've got the token, when I've saved it, when I'm retrieving it, every time anything at all happens with the token to try and find where the token is different - and when I ran it, it was working!!!! Same token, start to finish, client call works now. I never touched any actual code, just put in a whole bunch of debug statements, and it's just decided to start working. ARGH! Hair-tearing frustration, and it just decides to start working just like that.

(sigh) Well, at least now it's working. Thanks for your time Greg. Hopefully have some smooth sailing from here (though the fact that it just started working without me changing any actual code is worrying that it may just stop working again)...

View solution in original post

Work Smarter with Dropbox

The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.

Sound good? Let's get started.
Who's talking

Top contributors to this post

What do Dropbox user levels mean?
Need more support?