function documentClick(urn, name) {
window.location.href = "/viewer/urn/" + urn;
}
let access_token = '';
var oauth = require('./routes/oauth')
app.get('/api/forge/oauth', function(req, res) {
oauth()
.then(function (response) {
// Success
// let's save token into the varible access_token
access_token = response.data.access_token;
console.log(response);
console.log(access_token);
// Then, the app is routed to, which creates a shared bucket for our app.
res.redirect('/api/forge/datamanagement/bucket/create');
})
.catch(function (error) {
// Failed
console.error(error);
res.send('Failed to authenticate');
});
});
module.exports = oauth => {
return Axios({
method: 'POST',
url: 'https://developer.api.autodesk.com/authentication/v1/authenticate',
headers: {
'content-type': 'application/x-www-form-urlencoded',
},
data: querystring.stringify({
client_id: FORGE_CLIENT_ID,
client_secret: FORGE_CLIENT_SECRET,
grant_type: 'client_credentials',
scope: scopes
})
})
}