App with id not found

  • 26 May 2021
  • 3 replies
  • 58 views

Badge +2

I beleive I am getting the above error because I am not authorizing the app to work with the Miro REST API. However, I am not sure how to do this as I was confused by the documentation on the website. I would appreciate any advice to go about fixing this.


3 replies

Userlevel 4
Badge +6

Hi @manavb1,

 

Miro’s platform offers different components to build your app:

  • A Web SDK: this is used to build things inside a board. This is a front end library allowing you to build web plugins that will interacts in a Miro board. You can find some examples here.
  • REST APIs: this is the back-end side of the thing, the REST APIs allow you to:
    • Read and update lists of users and their rights on specific boards
    • Create and share boards
    • Create, delete, move and update widgets
    • Add custom data to widgets
  • Embed
    • To Embed a Miro board into another application

I am a little confused by what you are trying to build.

In your case: 

  • if you want to create a web plugin, so when someone in a Miro board does a specific action it creates stickers from issues you only need the Web SDK to do it.
  • If you want to create stickers from “outside” of the board into different boards you need to use the REST API and not the Web SDK.

 

You seem to be using the Web SDK to retrieve a widget and update its metadata but as well doing a REST API call to this path (I am not sure which endpoint this one is):  ${this.baseUrl}/${clientId}/team/${boardInfo.account.id}/widget/board/${encodeURIComponent(boardInfo.id). 

 

It would be very useful if you could explain the use case you are trying to build so we can help you best.

You can find more information about the OAuth2 implementation for REST API here.

 

 

Badge +2

@Anthony Roux

I am using the REST API. Here is the code that makes the request:

async createWidgetFromIssue(issueKey, x, y) {
const appId = await miro.getClientId();
const clientId = appId.toString();
let token = await miro.getToken();
let boardInfo = await miro.board.getInfo();
return this.makeCall(() => fetch(`${this.baseUrl}/${clientId}/team/${boardInfo.account.id}/widget/board/${encodeURIComponent(boardInfo.id)}`, {
method: 'POST',
headers: {
'Authorization': 'Bearer ' + token,
'Content-Type': 'application/json'
},
body: JSON.stringify({ "issueKey": issueKey, "x": x, "y": y })
}), (successResponse) => successResponse.json())
.then(async (w) => {
let newWidget = await miro.board.widgets.get({ id: w.id });
miro.board.widgets.update({ id: newWidget[0].id, metadata: newWidget[0].metadata });
return newWidget;
});

}
    async makeCall(call, successResponse) {
return call()
.then(async (result) => {
if (result.status === 200)
return successResponse ? successResponse(result) : true;

const text = await result.text();
let errorMsg;
try {
const data = JSON.parse(text);
let log = `ENGX-MIRO Error (TraceId: ${data.traceId}) => ${data.message} `;
log = data.stackTrace ? log + ` || StackTrace: ${data.stackTrace}` : log;
log = data.innerException ? log + ` || InnerException: ${data.innerException}` : log;
console.error(log);
errorMsg = data.message;
} catch (err) {
errorMsg = text;
}
throw errorMsg;
})
.catch(err => {
if (err && (err.toString() == `TypeError: Failed to fetch` || err.toString() == `Error: Couldn't connect to server`))
throw `Could not connect to engx-miro server.`;
throw err;
});
}

this.baseURL = localhost:44500, which is where the REST API is located. The error happens somewhere in makeCall, and on the screen I simply get the message ‘App with id ‘3047….’ not found. I’m pretty sure it has something to do with authorizing the app, but I’m confused on how to go about doing this because the documentation for it seemed vague.

Userlevel 4
Badge +6

Hi @manavb1,

 

Could you please share more information about when you get this error? Are you using the REST API? The Web SDK? Is it in the admin panel? Do you have a piece of code you could share?

 

The more information you share with us, the better we can reproduce it and help you to solve it.

 

Regards,

Anthony

Reply