infor-cloud / m3-h5-sdk

https://infor-cloud.github.io/m3-h5-sdk/
34 stars 20 forks source link

Problem using login command 4 for multitenant #165

Open jtharing opened 1 year ago

jtharing commented 1 year ago

Hi!

I am having problem establishing connection to our M3 Cloud multi-tenant to develop H5SDK apps. I am following the instructions on github (https://github.com/infor-cloud/m3-h5-sdk/issues/55) but i am receiving an error when trying to retrieve the session cookie. The only parameter not explicitly stated is the url-to-m3 one, where i assumed. https://m3prdeuc1.m3.eu1.inforcloudsuite.com. Is this a correction assumption? I have followed the previous "installation"steps stated https://github.com/infor-cloud/m3-h5-sdk.

Any idea what i might be doing wrong?

Thanks!

This is the command i am running when i receive the error:

odin login -c --m3 https://m3prdeuc1.m3.eu1.inforcloudsuite.com Odin.ionapi

(the Odin.ionapi file is located in the same directory as the project itself)

-------------Command Promt messages---------------- C:\Users\thajoh0.DOMAIN\MeridionCETest>odin login -c --m3 https://m3prdeuc1.m3.eu1.inforcloudsuite.com Odin.ionapi A browser will pop up where you will be asked to sign in and approve the authorization request. Waiting for ION API Token Got ION API token Visiting 'https://m3prdeuc1.m3.eu1.inforcloudsuite.com/mne' to get session cookie TypeError: _page._client.send is not a function at getAllCookies (file:///C:/Users/thajoh0.DOMAIN/AppData/Roaming/npm/node_modules/@infor-up/m3-odin-cli/dist/commands/login.js:149:59) at Timeout. (file:///C:/Users/thajoh0.DOMAIN/AppData/Roaming/npm/node_modules/@infor-up/m3-odin-cli/dist/commands/login.js:135:39) at listOnTimeout (node:internal/timers:568:17) at process.processTimers (node:internal/timers:511:7) ERROR: Login command failed Usage: odin [options] [command]

swuendri commented 1 year ago

Hi @jtharing, you should use the ION API to access M3 and not M3 APIs directly. If I'm right this possibility was cancelled by Infor. Please use odin login -c Odin.ionapi to retrieve an access token. And you application should only call ION APIs.

wesped0 commented 1 year ago

Hi @jtharing, there is an issue when retrieving the cookies in the getAllCookies method due to a change in the puppeteer library.

In login.js, if you change the code from

const getAllCookiesResponse = await _page._client.send('Network.getAllCookies');

to

const cookies = await _page.cookies(); return cookies;

it will work.

ismail-spoon commented 1 year ago

I'm having similar problem which I mentionned in this issue.

174