Git Product home page Git Product logo

Comments (3)

weierophinney avatar weierophinney commented on August 17, 2024

hi,
i have the same problem, have you solved it and can give me a hint?


Originally posted by @gnomium at zfcampus/zf-oauth2#130 (comment)

from api-tools-oauth2.

weierophinney avatar weierophinney commented on August 17, 2024

Well, detailing a thorough answer on OAuth2 workflows and architecture would take ages, and here is definitely not the right place.

Briefly, AuthController is not meant to be extended for "business controllers". Its purpose is to handle authentication requests:

  • generating / revoking tokens
  • handling authorization code...

and upon success, redirect to the requested routes (controller/action).

What you can do indeed, as referred in https://github.com/zfcampus/zf-oauth2#how-to-protect-your-api-using-oauth2, is to inject the server instance (OAuth2\Server) into your controller from its factory and call its methods from your actions ($this->server->verifyResourceRequest...)

Note: forget about this ugly 'onDispatch' call within your controller. Its location should be in a dedicated listener and called from you 'onBootstrap' callback in your module class ;)


Originally posted by @jguittard at zfcampus/zf-oauth2#130 (comment)

from api-tools-oauth2.

weierophinney avatar weierophinney commented on August 17, 2024

@jguittard

Can you please share any code example for injecting the server instance (OAuth2\Server) into controller from its factory and call its methods from actions ?


Originally posted by @fahadonline at zfcampus/zf-oauth2#130 (comment)

from api-tools-oauth2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.