Download the PHP package wefabric/token-login without Composer

On this page you can find all versions of the php package wefabric/token-login. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package token-login

Laravel Token Login

Allows to login an user by an unique token.

Security Concerns: Using tokens for login is a security concern because it’s the equivalent of storing a password in plain text.

Table of Contents

Background

For private and closed applications we created this package to allow users to quickly sign in. For example: We provide updates to users by mail, in this mail we provide a one click login url (with an unique token for each user). The user doesn't have to fill in the login credentials and can quickly see it's private data.

Install

This project uses Laravel 7+ and requires PHP 7.4 as minimum version.

Publish the config and migration:

Check the configuration (config/token-login.php). By the default the token and expiration will be setup for the default User model. To use it with a custom model change the configuration accordingly. When you are all setup. Run the migration

Usage

This package adds commands to manage the tokens. By default configuration the user table will contain two new fields ('login_token' and 'login_token_expires_at').

Concerns

Add the following traits to the user model.

Token creation

After the traits are added, you need to run the following command to generate the tokens and expiration dates.

Login

When the tokens are created, it is possible to login by the token. The package adds the route /users/token-login by default (to change it, change the 'login_path' variable in the config/token-login.php file). You can do a GET and POST request to login, like the following:

https://site.test/users/token-login?token={TOKEN}

When the token is correct and not expired. The user will be redirected to the default redirect path (see config/token-login.php). You can also specify a redirect as parameter.

https://site.test/users/token-login?token={TOKEN}&redirect=https://site.test/my-redirect

Refresh tokens

The token expires after a certain period. To refresh the tokens, you can use the following command.

This will refresh all expired tokens.

Use this command in your scheduler. For example, let it run every five minutes.

Delete expired tokens

To delete all expired tokens run the following command

Delete all tokens

To delete all tokens run the following command

Exclude users

To exclude users from the token generation, change the following in the config (config/token-login.php)

Helper

There is a helper available for using this package.

To check if the token login is enabled:

To retrieve the login url for a specific model:

Maintainers

@leoflapper.

Contributing

Feel free to dive in! Open an issue or submit PRs.

Contributors

License

MIT © Wefabric


All versions of token-login with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package wefabric/token-login contains the following files

Loading the files please wait ...