Aurelia-open-id-connect plugin gives syntax error

Hi all,
I’m having issues with a aurelia systemjs implementation when using aurelia-open-id-connect plugin.
Somehow when using the plugin, the aurelia project won’t start and gives a syntax error.
When using the plugin in our aurelia webpack webapp, everything works fine.
I made a post about it on the github for the plugin but it doesn’t seem very alive anymore so i’m asking my question here :slight_smile:
Is there someone who might now wat can cause the issue?
I copied my problem(full text) from the post on the github here below :).
Edit 2:
our webpack project is running aurelia 0.34.0 and our systemjs project is running 0.35.0.
end Edit 2

Edit 3
also changed the index.html as described by the plugin page to have a div wrapper

<body >
  <div aurelia-app="main">
    <script src="scripts/vendor-bundle.js"></script>
      SystemJS.import("aurelia-bootstrapper").catch(function (error) { console.log(error); });
      Promise.config({ longStackTraces: false, cancellation: true });
    <script src="scripts/jquery.signalR.min.js"></script>
    <!--<script src="signalr/hubs"></script>-->

End edit 3*

Original post can be found here

I’m having issues getting the aurelia-open-id-connect plugin to work in a aurelia systemjs project.
Somehow when i add the following code to the main.ts a ‘unexpected token <’ error appears in the log. When i remove the code below, the error disappears and my application starts normal
aurelia.use.plugin('aurelia-open-id-connect', () => openIdConfiguration);

The project is running aurelia-cli 0.35.0 with systemjs 0.21.5.
I have added the plugin and oidc-client plugin to my aurelia.json file but it did not help. I also edited my app.ts routes with the OpenIdConnectRoles but that also did not help.

I looked at the demos and from what i can tell everything looks good.

Config that is used:

import { OpenIdConnectConfiguration } from "aurelia-open-id-connect";
import { UserManagerSettings, WebStorageStateStore } from "oidc-client";

const appHost = "http://localhost:9000";

export default {
  loginRedirectRoute: "/private",
  logoutRedirectRoute: "/index",
  unauthorizedRedirectRoute: "/index",
  userManagerSettings: {

    // The number of seconds in advance of access token expiry
    // to raise the access token expiring event.
    accessTokenExpiringNotificationTime: 1,

    // Either host your own OpenID Provider or select a certified authority
    // from the list
    authority: "http://localhost/CustomerName/Identity/",

    automaticSilentRenew: true,

    // IdentityServer4 supports OpenID Connect Session Management
    monitorSession: true,
    checkSessionInterval: 2000,

    // The client or application ID that the authority issues.
    client_id: "CustomerClient",

    filterProtocolClaims: true,
    loadUserInfo: false,
    post_logout_redirect_uri: `${appHost}/signout-oidc`,
    redirect_uri: `${appHost}/signin-oidc`,
    response_type: "id_token",
    scope: "openid jcc-setup",
    // number of millisecods to wait for the authorization
    // server to response to silent renew request
    silentRequestTimeout: 10000,
    silent_redirect_uri: `${appHost}/signin-oidc`,
    userStore: new WebStorageStateStore({
      prefix: "oidc",
      store: window.localStorage,
  } as UserManagerSettings,
} as OpenIdConnectConfiguration;

Edit 1
Forgot to mention this:

            "name": "aurelia-open-id-connect",
            "path": "../node_modules/aurelia-open-id-connect/dist/amd",
            "main": "index"

End edit 1*
Have i forgotten something?

1 Like

You are using an old version of the Aurelia CLI, the CLI didn’t have autotracing back then, so each dependency needed to be declared in aurelia.json
The readme of aurelia-open-id-connect is for the latest version of the CLI, if you can’t update, see below for the old CLI procedure

FYI, I’m not sure this will fix your specific issue, but I’m quite sure it won’t work without those lines in your aurelia.json :slight_smile:

1 Like

Hi @arnederuwe ,
thnx for the reply!
aurelia.json does have the lines mentioned.
apologies for not mentioning that in the opening post.

1 Like

I can’t see any immediate issues in your code :confused: , would it be possible to provide a project where the error can be reproduced?
Is the “unexpected token <” error coming from one of the js files? Can you see if you can trace the source of the error? It could also come from a malformed http response

1 Like

hmm oke,
i’ll try and see if i can get a new project up and running and hopefully has the same issue.
if not, i’m afraid it will be something in the project i’m editing.
I’ll edit this post if i have more news(or post a new rereply if someone else has posted in between).

I stripped down the solution the problem exists in and it still occures.
I uploaded it to github and hope it wend okay(first time xD).
Url to the project:

1 Like

I managed to get your project working, i posted the solution in your github issue


Thnx for the help! it worked!
I was not aware of loading the resources due to the older cli version.
Thnx again!!

1 Like