Skip to content

Example app shell to leverage auth0 as authentication provider.

License

Notifications You must be signed in to change notification settings

piral-samples/piral-auth0-sample

Repository files navigation

Piral Logo

Sample app shell to leverage auth0 as authentication provider.

⚡ This sample demonstrates using piral-oidc to connect to an available auth0 identity provider.

Feel free to play around with the code using StackBlitz.

Open in StackBlitz

You can visit this demo at auth0.samples.piral.cloud/.

Getting Started

Install the dependencies:

npm install

If you want to change the values to your auth0 provider then go ahead and modify the values in the src/client.ts module. These values need to come from auth0 as shown in the next section.

Now run:

npm start

The app shell should be up and running.

For the sample you can log in with the following sample credentials:

  • Username is foo@bar.com
  • Password is foobar followed by 123 and !

Note: Due to the auth0 configuration only port 1234 is working (only accepting http://localhost:1234 requests).

Auth0 Setup

The whole configuration can be found at OIDC config.

Not much has changed there from the default options. The only things that are necessary are the client details that can be found in the application settings:

OIDC Client Details

The allowed login / logout and request URLs need to be configured:

OIDC Client Settings

Make sure to also include URLs of your other environments if applicable.

More Information

You find more information at the the oidc plugin page.

Most issues will actually be solved by getting familiar with the library (oidc-client) underneath. See oidc-client.

License

Piral and this sample code is released using the MIT license. For more information see the license file.