{"repo":"ryangjchandler/bearer","free":true,"listed":false,"github":"https://github.com/ryangjchandler/bearer","clone":"git clone https://github.com/ryangjchandler/bearer.git","description":"Minimalistic token-based authorization for Laravel API endpoints.","language":"PHP","stars":81,"topics":["laravel","api","api-auth","laravel-api"],"license":"MIT","category":"api-integrations-sdks","readme_excerpt":"Bearer Minimalistic token-based authorization for Laravel API endpoints. Installation You can install the package via Composer: You can publish and run the migrations with: You can publish the config file with: Usage Creating tokens To create a new token, you can use the RyanChandler\\Bearer\\Models\\Token model. Alternatively, you can use the RyanChandler\\Bearer\\Facades\\Bearer facade to generate a token. By default, Bearer uses time-ordered UUIDs for token strings. You can modify this behaviour by passing a Closure to Bearer::generateTokenUsing . This function must return a string for storage to the database. Retrieving a Token instance To retrieve a Token instance from the token string, you can use the RyanChandler\\Bearer\\Facades\\Bearer facade. Using a token in a request Bearer uses the Authorization header of a request to retreive the token instance. You should format it like so: Verifying tokens To verify a token, add the RyanChandler\\Bearer\\Http\\Middleware\\VerifyBearerToken middleware to your API route. Token expiration If you would like a token to expire at a particular time, you can use the expires at column. Or just use the class's helper methods. If you try to use the token after this time, it will return an error. Limit tokens to a particular domain Token usage can be restricted to a particular domain. Bearer uses the scheme and host from the request to determine if the token is valid or not. If you attempt to use this token from any domain other than https://laravel.c","default_branch":null,"files":null,"tree":[],"storefront":"/r/ryangjchandler","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/ryangjchandler/bearer/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}