chimit's avatar

Lumen as OAuth2 server: how to make an authorization dialog?

Lumen is made for APIs. Many APIs today use OAuth2 mechanism, and the most popular grant is "Authorization code grant" when user is redirected to a web page and asked for permission confirmation like this:

OAuth2

At the same time, Lumen 5.2 lost Views module. So how to implement this page in Lumen today?

0 likes
3 replies
primordial's avatar

If you need a frontend with Lumen you should probably be using Vue, Angular, Ember or such like. I believe it is designed to work as a "microservice", you may have the wrong tools for the job.

chimit's avatar

@primordial to use frontend JS library we need to make another (non-standard) API methods on the backend. Isn't it too complicated?

It's a little bit weird for the framework, which is designed for APIs, not to support very standard scenarios.

primordial's avatar

@Chimit If you want an oauth server try https://laravel.com/docs/5.3/passport with Laravel which works out of the box. I believe their are Lumen forks.

I work in a microservices environment which is very complicated and beyond your needs but as an example I use an angular front-end which talks with a common Lumen API (referred to as the frontend-backend). This API is full of custom, business-driven endpoints that are specific to the application. The frontend-backed API makes various calls to various other APIs in order to achieve the business-driven objective. For example; I have an endpoint called "connectToTwitter" which calls our User API, Social Media API and our Twitter API wrapper.

Apologies if I have gone off-topic.

Please or to participate in this conversation.