Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JWT iframe request returns TypeError #114

Closed
afaraha8403 opened this issue Jan 25, 2022 · 2 comments
Closed

JWT iframe request returns TypeError #114

afaraha8403 opened this issue Jan 25, 2022 · 2 comments

Comments

@afaraha8403
Copy link

afaraha8403 commented Jan 25, 2022

When sending the below postMessage an error is returned. Probably hit this snap on the JWT request as I was building the internal service...

TypeError: Cannot destructure property 'service' of 't' as it is undefined.

Request

  let jwtReq = {
    id: 'XXXX',
    service: 'identity',
    method: 'jwt',
    payload: {
      accessLevel: user.accessLevel,
      accessLevelHmac: user.accessLevelHmac,
      encryptedSeedHex: user.encryptedSeedHex
    }
  };
  vLog('JWT request', jwtReq);
  let iFrame = document.getElementById('SOMEID').firstChild.contentWindow;
  iFrame.postMessage(jwtReq, '*');

Returned Error

main-es2015.7fd4f7fb2e638fd391c6.js:1 ERROR TypeError: Cannot destructure property 'service' of 't' as it is undefined.
    at e.handleMessage (main-es2015.7fd4f7fb2e638fd391c6.js:1:1661185)
    at main-es2015.7fd4f7fb2e638fd391c6.js:1:1657249
    at u.invokeTask (polyfills-es2015.f888aaa0bd730994945c.js:1:20709)
    at Object.onInvokeTask (main-es2015.7fd4f7fb2e638fd391c6.js:1:1417062)
    at u.invokeTask (polyfills-es2015.f888aaa0bd730994945c.js:1:20630)
    at a.runTask (polyfills-es2015.f888aaa0bd730994945c.js:1:16118)
    at l.invokeTask [as invoke] (polyfills-es2015.f888aaa0bd730994945c.js:1:21759)
    at f (polyfills-es2015.f888aaa0bd730994945c.js:1:33720)
    at h (polyfills-es2015.f888aaa0bd730994945c.js:1:33965)

Traces back to this

                handleMessage(e) {
                    const {data: t} = e
                      , {service: r, method: n} = t;
                    "identity" === r && (n ? this.handleRequest(e) : this.handleResponse(e))
                }
@afaraha8403 afaraha8403 changed the title JWT iframe request returns error JWT iframe request returns TypeError Jan 25, 2022
@maebeam
Copy link
Contributor

maebeam commented Jan 25, 2022

Wrap in data key

  iFrame.postMessage({data: jwtReq}, '*');

@maebeam maebeam closed this as completed Jan 25, 2022
@afaraha8403
Copy link
Author

@maebeam this does not solve the issue. Now identity does not return anything!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants