Pow: Using PowResetPassword & PowEmailConfirmation in an API?

Created on 21 Oct 2019  路  5Comments  路  Source: danschultzer/pow

Is this possible / easy? Any hints on how to get started? I was thinking of making a throwaway project, turning on PowResetPassword PowEmailConfirmation for the web api, using my browser tools to watch the requests being made, then re implementing them in the API. I also might have to copy/modify the default controllers for these.

Most helpful comment

Here's my guide for PowResetPassword.
https://github.com/mreishus/notebook-pub/blob/master/programming/phoenix/pow/adding-reset-password-to-an-api.md

I probably won't be touching the other two plugins (Invite or Persistent). Not sure that Persistent even makes sense with an API.

All 5 comments

Yes, but the implementation depends on the API requirements. I would recommend you to follow the API guide first: https://hexdocs.pm/pow/1.0.13/api.html#content

This should give you understanding of what is required to get Pow working in an API. You'll have to build your own controllers, but you can leverage the plug methods. Both PowResetPassword and PowEmailConfirmation has their plug methods documented.

I also recommend that you dig into the custom controllers guide to see how extensions are dealt with. This is where the main difference will be from the default behavior in Pow and how API will handle authentication and registration.

It might be good to have as a guide on https://powauth.com/guides/ so please post any code you work out from this so it can help others 馃殌

Ok, giving it a shot, I'll share what I find

I was able to get a very basic PowEmailConfirmation setup working. I documented what I did here: https://github.com/mreishus/notebook-pub/blob/master/programming/phoenix/pow/adding-email-confirmation-to-an-api.md

Here's my guide for PowResetPassword.
https://github.com/mreishus/notebook-pub/blob/master/programming/phoenix/pow/adding-reset-password-to-an-api.md

I probably won't be touching the other two plugins (Invite or Persistent). Not sure that Persistent even makes sense with an API.

This is great, thanks! I'm moving the discussion over to https://github.com/pow-auth/pow_site/issues/14 馃槃

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sepowitz picture sepowitz  路  4Comments

dweremeichik picture dweremeichik  路  7Comments

chevinbrown picture chevinbrown  路  6Comments

danschultzer picture danschultzer  路  5Comments

JonRCahill picture JonRCahill  路  3Comments