I am using Pow for authentication. Does Pow provide a mechanism to retrieve current_user profile info?
I have users profile info maintained in a separate tables(based on user’s role) and would like to create/view/update user profile info based on current logged in user.
Yes. You should have a Pow plug in your Endpoint. Sp you should be able to do
@current_user if current user is logged in.
defmodule MyAppWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :my_app
plug Plug.Session, @session_options
plug Pow.Plug.Session, otp_app: :my_app
Thanks, andreaseriksson. However, I am using backend only for API. Whats changes it requires to get current_user info from API?
You would still need some sort of Plug for that. Then check conn.assigns in the controller.
Thanks, andreaseriksson. I got it to work with Pow.Plug.current_user(conn)