Curious about A, B, C, and D drives? Learn what they mean and how to use them effectively with Dropbox in this handy guide! - check it out now!
Forum Discussion
marika8
6 months agoExplorer | Level 3
Will I keep getting charged, if I can't access my account due to code being sent to inactive email?
If I can't access my existing DropBox account due to 2-step verification to my disabled email account, you will NOT charge me for my DropBox Plus, right?
It's not possible to get a refresh token from an access token. A refresh token can only be retrieved by authorizing the app via the OAuth app authorization flow. (The "Generate" button on an app's page on the App Console does not offer the ability to get a refresh token; that only returns an access token.) To get a refresh token for a user account, an app should implement the OAuth app authorization flow, and request "offline" access. You can also find more information in the authorization documentation.
The /oauth2/token call you shared is failing because the "code" parameter there expects an "authorization code", not an access token.
If this is just for your own account though, you can process this manually without implementing the OAuth app authorization flow in your app's code/UI.
For instance, you could:
1. Make your OAuth app authorization URL like this: (plug in your app key in place of "APPKEYHERE").
https://www.dropbox.com/oauth2/authorize?client_id=APPKEYHERE&response_type=code&token_access_type=offline
2. Browse to that page in your browser while signed in to your account and click "Allow" to authorize it.
3. Copy the resulting authorization code.
4. Exchange the authorization code for an access token and refresh token like this, e.g., using curl on the command line: (plug in the authorization code from step 3 in place of "AUTHORIZATIONCODEHERE", the app key in place of "APPKEYHERE", and the app secret in place of "APPSECRETHERE").
curl https://api.dropbox.com/oauth2/token \ -d code=AUTHORIZATIONCODEHERE \ -d grant_type=authorization_code \ -u APPKEYHERE:APPSECRETHERE
The response will contain a short-lived access token and refresh token that you can then use as needed.
5. Store the returned refresh token. (It can be repeatedly re-used and doesn't expire by itself, though it can be revoked on demand.)
6. Use the returned short-lived access token to make API calls until it expires. For example, here's how a call to get the connected user information would look like: (plug in the access token from step 4 in place of "ACCESSTOKENHERE")curl -X POST https://api.dropboxapi.com/2/users/get_current_account \ --header "Authorization: Bearer ACCESSTOKENHERE"
7. Retrieve a new short-lived access token whenever needed like this, e.g., using curl on the command line: (plug in the refresh token from step 5 in place of "REFRESHTOKENHERE", the app key in place of "APPKEYHERE", and the app secret in place of "APPSECRETHERE")curl https://api.dropbox.com/oauth2/token \ -d refresh_token=REFRESHTOKENHERE \ -d grant_type=refresh_token \ -d client_id=APPKEYHERE \ -d client_secret=APPSECRETHERE
8. Use the returned short-lived access token to make API calls until it expires. For example, here's how a call to get the connected user information would look like: (plug in the new access token from step 7 in place of "ACCESSTOKENHERE")curl -X POST https://api.dropboxapi.com/2/users/get_current_account \ --header "Authorization: Bearer ACCESSTOKENHERE"
Repeat steps 7 and 8 programmatically as needed.Hope this helps!
3 Replies
Sort By
- Rich
Super User II
marika8 wrote:
If I can't access my existing DropBox account due to 2-step verification to my disabled email account, you will NOT charge me for my DropBox Plus, right?
They have no way of knowing that you can't access the account, so you'll continue to be charged until you cancel the subscription. You'll need to contact Dropbox Support for assistance.
Visit the Support page while you're NOT signed in to a Dropbox account, including these forums, and you'll see an option for Billing issues. It's best to use an Incognito or Private browsing session to make sure you're not signed in.
- marika8Explorer | Level 3
Thank you for your advice, but... I have to be in my account to do that. I remembered my password, but I had it 2-factor authenticated it to my email.....so I can't really access it.
The credit card is now closed. So, I won't be charged. Does this mean I will forever lose my DropBox account? 😭
- Rich
Super User II
marika8 wrote:
Thank you for your advice, but... I have to be in my account to do that.
That's why you need to contact Dropbox using the specific steps I mentioned. They'll assist in getting your subscription cancelled.
The credit card is now closed. So, I won't be charged.
Cancelling a credit card doesn't always prevent additional charges. You need to get the subscription cancelled properly.
Does this mean I will forever lose my DropBox account?Most likely, yes. If you're unable to receive the one-time security code, there's no way to gain access to the account. Dropbox Support will help you cancel the subscription, but they generally won't provide access to the account.
About Integrations
Find solutions to issues with third-party integrations from the Dropbox Community. Share advice and help members with their integration questions.
Need more support
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!