Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider moving APIAuthPlug into Pow #634

Open
LandonSchropp opened this issue Jul 13, 2021 · 1 comment
Open

Consider moving APIAuthPlug into Pow #634

LandonSchropp opened this issue Jul 13, 2021 · 1 comment

Comments

@LandonSchropp
Copy link
Contributor

LandonSchropp commented Jul 13, 2021

I've recently followed the How to use Pow in an API, and overall the experience was great. The very first paragraph of this document is the following:

Pow comes with plug n' play support for Phoenix as HTML web interface. API's work differently, and the developer should have full control over the flow in a proper built API. Therefore Pow encourages that you build custom controllers, and use the plug methods for API integration.

Overall, I very much agree with this philosophy. I was able to tweak the Pow API implementation to suit my application, and the process was very painless.

However, one thing in this approach stood out to me: the APIAuthPlug. I copied this module into my app verbatim, and other than changing MyAppWeb, there wasn't anything in this file specific to my application. Maybe I haven't experienced the full use cases of modifying this file so far, but I'm struggling to see what I would want to modify in this file.

I personally feel like this module should be moved into Pow. I think there are a few benefits of doing so:

  • Keeping this module in Pow helps to maintain the abstractions that Pow provides. Modifying this file seems to require a specific understanding of how Pow works, which I don't think many users of Pow would have (myself included).
  • If the file were moved into Pow, it could be thoroughly tested like the rest of the Pow codebase.
  • If there's ever a need to modify this file in the future, it could be done without any issues with existing applications.

If anyone ever did need to modify the behavior of this file, they could copy it into their application and make the modifications.

If you're open to this change, I'd be happy to do the legwork of getting it into the repo and updating the api.md document.

Thanks!

@LandonSchropp LandonSchropp changed the title Consider moving Consider moving APIAuthPlug into Pow Jul 13, 2021
@LandonSchropp
Copy link
Contributor Author

@danschultzer Bump.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant