User Management Internal routes throws cors error

The Routes in User management throws cors error when called from another app. Eg(/rest/login). I understand that these are internal apis, but we are counting on it for logging in programatically and embedding it in the UI. I modified the cors.ts file. But Still it throws the same error. Also, used the corsMiddleware object in the this.app.use() of user management addroutes method. But it still throws error. Also, When I try to move this api call to backend (deployed separately), the cookie is not being set in the browser due to cross domain issues.

Can you please suggest workarounds if any ?

Hey @Mahesh_Thiru,

I suspect the issue here will be exactly what you have pointed at, These are internal APIs and not really designed to be use from outside of n8n which makes their use unsupported to a point.

That being said are you connecting directly to the backend API or going through a proxy first?

Hello @Jon ,
Happy New Year. I am directly using /rest/login to fetch the cookie and then loading the workflows screen in a iframe. Is there any other easy way to embed n8n other than this ?

Regards

Hey @Mahesh_Thiru,

We have seen a few issues with loading n8n in an iframe but I don’t think I have seen anyone try to do the login before. If you just load the page in an iframe and login that way does it work as expected?

It could be worth looking at: Tried embedding n8n using iframes but the the workflow page is not loading - #10 by AnjanaSAcroUser as a starting point

1 Like

@Jon ,

Yes, It works as expected when I login from the iframe. I will go through the article and get back to you. Thank you very much for sharing.

Regards

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.