Skip to content

Environment Variables

Jeremy Postlethwaite edited this page Feb 17, 2024 · 9 revisions

Authentication and Authorization

env() type config()
PLAYGROUND_AUTH_VERIFY string playground-auth.verify
PLAYGROUND_AUTH_SANCTUM bool playground-auth.sanctum
PLAYGROUND_AUTH_HAS_PRIVILEGE bool playground-auth.hasPrivilege
PLAYGROUND_AUTH_USER_PRIVILEGES bool playground-auth.userPrivileges
PLAYGROUND_AUTH_HAS_ROLE bool playground-auth.hasRole
PLAYGROUND_AUTH_USER_ROLE bool playground-auth.userRole
PLAYGROUND_AUTH_USER_ROLES bool playground-auth.userRoles

Debugging

To enable debugging troubleshooting messages while implementing token abilities, set both app.debug and playground-auth.debug to TRUE.

Also make sure: LOG_LEVEL === DEBUG. And check your stack. You can see what is set in artisan about

These options may be set via the configuration files of the .env.

env() type config()
APP_DEBUG bool app.debug
LOG_LEVEL string debug
PLAYGROUND_AUTH_DEBUG bool playground-auth.debug

See the debugging messages using Log::debug

Packages

Specify the packages that have abilities:

env() type config()
PLAYGROUND_AUTH_PACKAGES string playground-auth.packages
PLAYGROUND_AUTH_REQUIRE_PACKAGE_ABILITIES bool playground-auth.require.package_abilities
  • PLAYGROUND_AUTH_PACKAGES is a CSV list of package slug configuration names, spaces are permitted.

For example:

#
PLAYGROUND_PACKAGES=playground,playground-auth,playground-blade,playground-http,playground-login-blade,playground-site-blade,playground-matrix-resource,playground-test
#
PLAYGROUND_AUTH_PACKAGES=playground-login-blade, playground-site-blade, playground-matrix-resource
  • By default, playground-auth is included in PLAYGROUND_AUTH_PACKAGES, if omitted, when PLAYGROUND_AUTH_REQUIRE_PACKAGE_ABILITIES === true

Loading

env() type config()
PLAYGROUND_AUTH_LOAD_COMMANDS bool playground-auth.load.commands
PLAYGROUND_AUTH_LOAD_TRANSLATIONS bool playground-auth.load.translations

Redirects

env() type config()
PLAYGROUND_AUTH_REDIRECT string playground-auth.redirect

Publish the configuration to disable redirects an authentication errors:

/*
|--------------------------------------------------------------------------
| Redirects
|--------------------------------------------------------------------------
|
| PLAYGROUND_AUTH_REDIRECT may be disabled to show an error page instead.
*/

/**
 * @var ?string redirect   Specify for redirect()->guest($redirect)
 */
// 'redirect' => env('PLAYGROUND_AUTH_REDIRECT', 'login'),
'redirect' => null,

Token

env() type config()
PLAYGROUND_AUTH_TOKEN_ABILITIES string playground-auth.token.abilities
PLAYGROUND_AUTH_TOKEN_EXPIRES string playground-auth.token.expires
PLAYGROUND_AUTH_TOKEN_NAME string playground-auth.token.name
PLAYGROUND_AUTH_TOKEN_LISTED string playground-auth.token.listed
PLAYGROUND_AUTH_TOKEN_ROLES string playground-auth.token.roles
PLAYGROUND_AUTH_TOKEN_PRIVILEGES string playground-auth.token.privileges
PLAYGROUND_AUTH_TOKEN_SANCTUM string playground-auth.token.sanctum
Clone this wiki locally