cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Musicians, convert your MuseScore files to PDF to play music on the go! 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: 

Property 'auth' does not exist on type 'Dropbox'

Property 'auth' does not exist on type 'Dropbox'

nevermindx
Explorer | Level 4

auth

export class DropboxService {
private dbx: Dropbox

constructor() {
this.dbx = new Dropbox({
fetch,
clientId: dropboxConfig.clientId,
clientSecret: dropboxConfig.clientSecret,
})
}

generateAuthUrl() {
const authUrl = this.dbx.auth.getAuthenticationUrl(
dropboxConfig.redirectUri,
undefined,
'code',
)
return authUrl
} shows error auth doest not exist on Dropbox
3 Replies 3

Здравко
Legendary | Level 20

Ha..🤣 You just found an imperfection out. 🤫

The 'auth' field is there, but for whatever reason is not declared in type script. 🤷 That's why your interpreter complains.

You can workaround as re-declare Dropbox and include the "missing" field or construct DropboxAuth object on your own, save a reference, and pass it on construction of Dropbox object - this.auth = new DropboxAuth({fetch, ...}); this.dbx = new Dropbox({auth}) (so instead of this.dbx.auth... you may use just this.auth...).

Hope this helps.

Greg-DB
Dropbox Staff

Thanks for the report! I'll ask the team to add this to the types.

nevermindx
Explorer | Level 4

got the solution actually i had to do 

importDropboxAuth } from 'dropbox' instead of  import { Dropbox } from 'dropbox'
 
then i was able to to do  dbxAuth.getAuthenticationUrl()
 
Need more support?
Who's talking

Top contributors to this post

  • User avatar
    nevermindx Explorer | Level 4
  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    Здравко Legendary | Level 20
What do Dropbox user levels mean?