Pow(Authentication) & Absinthe(GraphQL API) for building a website/web-app

Hi!
I’ve build a basic Pow & Absinthe API for authenticating the user, it works great for mobile(React-Native) app. I want to extend the api to use in website(cookies & sessions).

I’m stuck at the moment, have been scratching my head for the past few hours to figure out a way to achieve my goal. Right now my router.ex looks like as following

  # Mobile endpoints
  scope "/m", PetsWeb.API.V1 do
    pipe_through :api

    resources "/registration", RegistrationController, singleton: true, only: [:create]
    resources "/session", SessionController, singleton: true, only: [:create, :delete]

    post "/session/renew", SessionController, :renew
  end

  scope "/m" do
    pipe_through [:api, :api_protected]

    forward "/", Absinthe.Plug, schema: PetsWeb.Schema
  end

I’m setting access, refresh tokens and access_token_expiry_time in this Pow API authentication. Now I would like to extend this api for website by setting a cookie for authorization mechanism.

Any help on this would be greatly appreciated :slight_smile:

@benwilson512 How do I build an Absinthe context to use cookies for current_user?
Any advice would really be helpful.

Thank you and have a great day ahead!

Figured out the solution long time ago by creating a web_context_plug and checking cookie values.

Closing this question.