Hi All!
I'm working on a VueJS App with Axios library.
I just want to authorize my WebApp to access to my DropBox account with OAuth2 but I'm stuck at the beginning because it returns me:
TypeError: e.clone is not a function
Here is my Vue App code to generate the access token:
beforeCreate() {
delete axios.defaults.headers.common['X-CSRF-TOKEN']; // Forced to use that with axios
window.dbx = new this.$root.Dropbox({ // Create the Dropbox instance, works well
fetch: axios,
clientId: 'myClientID',
clientSecret: 'myClientSecret'
});
},
async created() {
// Search for access token in local storage
if(localStorage.dbx_token) this.dbx_token = localStorage.dbx_token;
else {
let params = new URL(window.location.href).searchParams, // Or currently asked
code = params.get("code"),
csrf_token = params.get("state");
if (csrf_token == this.csrf_token) { // OAuth returns
try { // Try to get an access token
this.dbx_token = await dbx.getAccessTokenFromCode('http://localhost/fanny/public/', code);
} catch(error) {
console.log(error);
}
}
}
// If found, generate DBX API
if(this.dbx_token) dbx.setAccessToken(this.dbx_token);
}
Access token always returns undefined and console says TypeError: e.clone is not a function
An idea?