InvalidTokenError for Electron App

I’m following this tutorial Securing Electron Applications with OpenID Connect and OAuth 2.0.

I’m able to show the Auth0 login form https://cdn.auth0.com/blog/electron-openid-connect-oauth/the-authorization-server-login-page.png. Then it shows the user account avatar then keeps on loading indefinitely. Then I decided to stop it but after I do yarn start again it shows this error on my terminal

yarn run v1.16.0
$ electron ./
(node:18649) UnhandledPromiseRejectionWarning: InvalidTokenError
    at Object.<anonymous> (/home/qrs/Programming/App/Auth/my-electron-openid-oauth/frontend/node_modules/jwt-decode/lib/index.js:9:31)
    at Module._compile (internal/modules/cjs/loader.js:808:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:820:10)
    at Module.load (internal/modules/cjs/loader.js:677:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:609:12)
    at Function.Module._load (internal/modules/cjs/loader.js:601:3)
    at Module.require (internal/modules/cjs/loader.js:715:19)
    at require (internal/modules/cjs/helpers.js:14:16)
    at Object.<anonymous> (/home/qrs/Programming/App/Auth/my-electron-openid-oauth/frontend/services/auth-services.js:1:19)
    at Module._compile (internal/modules/cjs/loader.js:808:30)
(node:18649) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:18649) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Done in 846.75s.

One of the comment on that article below shows the same experience and @bruno.krebs gave the answers. Still I got the same error.

Hello there, @isemaj. Welcome to our community.

Have you built the solution on your own following the steps on the article? If so, would you mind sharing it with me on a GitHub repo so I can check your code?

Thanks
Bruno Krebs

I don’t have the repo but I found out that it my mistake when I used the client id from the api because I skipped the step where I need to create an application that will represent the electron app and the client id from that newly created app is the one that I should use.

I’m glad you solved your problem, @isemaj. If you need help, don’t hesitate getting in touch. Cheers.

1 Like

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