pow-auth / pow_assent

Multi-provider authentication for your Pow enabled app
https://powauth.com
MIT License
321 stars 50 forks source link

Handle User Rejecting Permissions #169

Closed jt-l closed 4 years ago

jt-l commented 4 years ago

Is there anyway to handle where the user gets routed on a permissions error?

i.e.

Processing with PowAssent.Phoenix.AuthorizationController.callback/2 Parameters: %{"error" => "access_denied", "error_code" => "200", "error_description" => "Permissions error", "error_reason" => "user_denied", "provider" => "facebook", "state" => "f06f3f6qwedfa6b4ca0d0qwe309b3"}.

By default the controller appears to be throwing an error. Is there a way to handle this without having to create a customize controller? (i.e. It doesn't seem like pow_assent supports controller callbacks in the same way that pow does?).

Thanks.

danschultzer commented 4 years ago

Yeah, I was lazy with that, since I wasn't sure what should be the appropriate behavior. Likely it should just redirect back to the sign in page with a generic error message.

I'll think about what makes most sense, but in the meantime you could handle it with https://hexdocs.pm/plug/Plug.ErrorHandler.html, catching the exception and decide what to do from there. Also, if you have any suggestions for what should happen on provider error (remember, that this could also be client configuration issue that requires the developers immediate attention).

jt-l commented 4 years ago

Handling the error by redirecting to the sign in page with a generic error message seems reasonable. An error message such as: "Failed to proceed with {provider}" seems okay.

danschultzer commented 4 years ago

Resolved in #179