xmlking/ngx-starter-kit

localhost:8080 in dist/apps/webapp folder

localsite opened this issue · 2 comments

In the ReadMe.md Deploy section, can you add a link to info on configuring auth for gp-pages?

When manually copying the dist/apps/webapp folder to the root of a GitHub Pages repo, a path starting with localhost:8080 causes the following Javascript error:

localhost:8080/auth/realms/is360/.well-known/openid-configuration:1 
Failed to load resource: net::ERR_CONNECTION_REFUSED

(Manual copying of the dist/apps/webapp folder is my attempted workaround until I get npm run deploy:mock deploying.) #6

You need a hosted OpenID Connect server (in my case I am using keyclock) and when you are building for mock environment with npm run build:mock command, you should point to your own OpenID issuer
environment.mock.ts

  auth: {
    clientId: 'is360ui',
    issuer: 'https://keycloak-is360.7e14.starter-us-west-2.openshiftapps.com/auth/realms/is360'
  }

I am using OpenShift STARTER plan to host my KeyCloak OpenID server. you can use it if you want for testing.

If you are doing local testing, you can run docker-compose up keycloak to start local Auth server

PS: you need docker runtime on your laptop. I am using Docker fo Mac see Prerequisites

keycloak docs:

https://github.com/xmlking/ngx-starter-kit/blob/master/.docker/keycloak/TESTING.md

you can also use Google, Azure or Okta as your hosted OpenIDConnect Providers.

https://developers.google.com/identity/protocols/OpenIDConnect

https://developer.okta.com/docs/api/resources/oidc