Jump to content

Aladin SALEH

Members
  • Posts

    4
  • Joined

  • Last visited

Everything posted by Aladin SALEH

  1. Hi, Can someone tell me why I get this message when I try to get an access token : 'x-cache': 'Error from cloudfront', 'x-amzn-errortype': 'MissingAuthenticationTokenException', statusCode: 403, statusMessage: 'Forbidden', I've already check my rights (admin) I have searched everywhere but have not found anything. So if someone have aleady encounter this issue, please tell me how to solve it. Aladin SALEH
  2. I'm attempting to connect to Sage 50 . Aladin
  3. Hello, I'm trying to create a web application using sage. So I created a nodejs application (Oauth2 authentication server) to be able to make requests. But I don't know why when I try to authenticate myself the server refuses me access. I have admins rights I don't know where this error comes from. I have searched all afternoon in the documentation but nothing 😕 I hope someone could help me. Here is my code of my nodejs server const express = require('express'); const app = express(); const path = require('path'); const fs = require('fs'); const https = require('https'); const axios = require('axios'); const PORT = 3443; const clientID ='<myclientid>'; const clientSecret ='<myclientsecret>'; app.use(express.static(__dirname + '/public')) app.get('/callback', (req, res) => { const requestToken = req.query.code console.log(req.query.code); axios({ method: 'post', url:`https://oauth.accounting.sage.com/token&grant_type=authorization_code&code=${requestToken}client_id=${clientID}&client_secret=${clientSecret}&redirect_uri=https://localhost:3443/callback`, headers: { accept: 'application/json', } }).then((response) => { const accessToken = response.data.access_token; console.log(accessToken); res.redirect(`/welcome.html?access_token=${accessToken}`) }) }) const sslServer = https.createServer({ key:fs.readFileSync(path.join(__dirname,'cert','localhost.key')), cert:fs.readFileSync(path.join(__dirname,'cert','localhost.crt')) },app); sslServer.listen(PORT,()=>console.log('Adresse : https://localhost:3443/ \nServeur SSL : port : ' + PORT));
  4. I'm trying to learn the sage api I've tried to make a POST request for create a purchase invoice so I did as the documentation but i get this error message. "$message": "purchase_invoice[invoice_lines] is invalid" and I don't know why. Can someone help me ?
×
×
  • Create New...