You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1.6 KiB

authkit2 - Laravel Configuration

How to configure authkit2 in your Laravel project.

This requires that you have installed authkit2.

Credentials

There are two ways to configure the OIDC client:

  • With a JSON configuration file
  • With environment variables

JSON Configuration

In Keycloak, under Clients -> Your Client -> Installation, you can select the "Keycloak OIDC JSON" and receive a configuration file in a format such as:

{
  "realm": "Test",
  "auth-server-url": "http://localhost:8080/auth/",
  "ssl-required": "external",
  "resource": "test",
  "credentials": {
    "secret": "a0ee4936-ef77-4e4b-87f3-8b4a2706d53a"
  },
  "confidential-port": 0
}

Put this file in your application at storage/app/auth.json. You're done!

Environment Variables

  • AUTHKIT_CLIENT_ID: Client ID (resource in the above JSON)
  • AUTHKIT_CLIENT_SECRET: Client Secret (credentials.secret in the above JSON)
  • AUTHKIT_ENDPOINT: URL to the OIDC provider, including the full path to the realm when using keycloak, e.g., http://localhost:8080/auth/realms/Test)

Customization

There are several other customizable values that are not initially exposed. If you want to customize these values, you can publish the default configuration and customize it.

To publish the configuration, from your project's folder:

$ php artisan vendor:publish --tag authkit2_config

You can then edit the configuration at: config/authkit.php

Documentation for those options exists in the comments alongside them.

Next Steps

See Usage.