cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
If you’ve changed your email address, now's the perfect time to update it on your Dropbox account and we’re here to help! Learn more here.

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: 

Dropbox Bearer token is too short

Dropbox Bearer token is too short

TheKrominator
Explorer | Level 3
Go to solution

When I log in to DropBox, I get approved and receive my auth token. But, the token is too short!

I should receive : "################################-###############################"

but I get :             "###################-#######################"

This returns a "invalid_access_token" error. 

 

Below is my layout for passport-dropbox-oauth2:

app.get('/dropboxLogin', passport.authenticate('dropbox-oauth2'));

app.get('/auth/dropbox/callback',
passport.authenticate('dropbox-oauth2', { failureRedirect: '/' }),
function(req, res)
{
// Successful authentication, redirect home.
res.render('index', { title:'Dropbox Login', body:res});
});

app.get('/loggedIn', function(req,res)
{
//have bearer token
let token = req.query.code;
console.log(req.query);
res.redirect('/Callback/?token='+token);
});

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

It sounds like you're using the "code" flow, so Dropbox will return an "authorization code", not an access token. When using the code flow, once you receive the authorization code, you need to then exchange it for an access token using /oauth2/token.

 

Check out the /oauth2/authorize and /oauth2/token documentation for more information on how this works.

View solution in original post

1 Reply 1

Greg-DB
Dropbox Staff
Go to solution

It sounds like you're using the "code" flow, so Dropbox will return an "authorization code", not an access token. When using the code flow, once you receive the authorization code, you need to then exchange it for an access token using /oauth2/token.

 

Check out the /oauth2/authorize and /oauth2/token documentation for more information on how this works.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?