cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements
Known issues updated. Learn more
Highlighted

AuthException when already have token

Level 6

Have got authorisation via login working, slightly smiling face 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

Re: AuthException when already have token

Level 6

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)...

Reply
Loading...
4 Replies

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.

Reply
Loading...

Re: AuthException when already have token

Level 6

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?

Reply
Loading...

Re: AuthException when already have token

Level 6

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!).

Reply
Loading...

Re: AuthException when already have token

Level 6

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)...

Reply
Loading...
API Support

Have a question? Our Dropbox Community is here to help you find an answer!
You won’t have to wait too long for a reply, but why not learn more about the Community while you’re here.

Not the right discussion for you? Find out what else our Community has to say about API Support.

Or, search our Help Center for even more.

Who's talking
Top contributors to this post