dingo / dingo/api

Prefered auth extention method in Dingo ? Guard, middleware, api.auth etc.

Open
#1,535 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
9.4k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

| Q | A
| ----------------- | ---
| Bug? | no
| New Feature? | no
| Framework | Lumen
| Framework version | 5.6.5
| Package version | 2.0.0-alpha2
| PHP version | 7.1.14

#### Question
What is the prefered way of implementing custom authentication providers in Dingo v2 with Lumen?

I'm currently extending `Dingo\Api\Auth\Auth` in app.php to support Auth0 ([https://auth0.com](https://auth0.com)) like this:
```
app('Dingo\Api\Auth\Auth')->extend('auth0', function ($app) {
return new \App\Providers\Auth0ServiceProvider;
});
```
However, I would like to support multiple authentication providers in the future and I find above method a bit static.

I'm looking into using the `api.auth` routing middleware with configuration files, but there are other options as well.

Can anyone point in the direction of a fresh example or provide some recommendations?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.