<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="22299" data-post-id="22299">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Oxyrus" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Oxyrus/120/842_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Oxyrus
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I can’t get the authorization to work, I get a token successfully:</p>
<p></p><div class="lightbox-wrapper"><a class="lightbox" href="https://forum.elixirforum.com/uploads/default/original/2X/c/cdcc6ea9e400d12461215b5f72356bfc72b03983.png" data-download-href="https://forum.elixirforum.com/uploads/default/cdcc6ea9e400d12461215b5f72356bfc72b03983" title="http://i.imgur.com/sFmJJcX.png?1" rel="nofollow"><img src="https://forum.elixirforum.com/uploads/default/optimized/2X/c/cdcc6ea9e400d12461215b5f72356bfc72b03983_2_690x318.png" alt="http://i.imgur.com/sFmJJcX.png?1" width="690" height="318" srcset="https://forum.elixirforum.com/uploads/default/optimized/2X/c/cdcc6ea9e400d12461215b5f72356bfc72b03983_2_690x318.png, https://forum.elixirforum.com/uploads/default/optimized/2X/c/cdcc6ea9e400d12461215b5f72356bfc72b03983_2_1035x477.png 1.5x, https://forum.elixirforum.com/uploads/default/original/2X/c/cdcc6ea9e400d12461215b5f72356bfc72b03983.png 2x" data-dominant-color="F8F7F8"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">http://i.imgur.com/sFmJJcX.png?1</span><span class="informations">1361×628 44.1 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div><p></p>
<p>But when I do a query with the token it returns unauthorized</p>
<p></p><div class="lightbox-wrapper"><a class="lightbox" href="https://forum.elixirforum.com/uploads/default/original/2X/6/68a54ff7072702584b9034b4fa201d048817abcb.png" data-download-href="https://forum.elixirforum.com/uploads/default/68a54ff7072702584b9034b4fa201d048817abcb" title="http://i.imgur.com/0kldMcV.png?1" rel="nofollow"><img src="https://forum.elixirforum.com/uploads/default/optimized/2X/6/68a54ff7072702584b9034b4fa201d048817abcb_2_690x329.png" alt="http://i.imgur.com/0kldMcV.png?1" width="690" height="329" srcset="https://forum.elixirforum.com/uploads/default/optimized/2X/6/68a54ff7072702584b9034b4fa201d048817abcb_2_690x329.png, https://forum.elixirforum.com/uploads/default/optimized/2X/6/68a54ff7072702584b9034b4fa201d048817abcb_2_1035x493.png 1.5x, https://forum.elixirforum.com/uploads/default/original/2X/6/68a54ff7072702584b9034b4fa201d048817abcb.png 2x" data-dominant-color="A0A0A1"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">http://i.imgur.com/0kldMcV.png?1</span><span class="informations">1364×652 31 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div><p></p>
<p></p><div class="lightbox-wrapper"><a class="lightbox" href="https://forum.elixirforum.com/uploads/default/original/2X/b/b9f2bbb3c4fa18d284e56dd61735037691b43a5d.png" data-download-href="https://forum.elixirforum.com/uploads/default/b9f2bbb3c4fa18d284e56dd61735037691b43a5d" title="http://i.imgur.com/VAys8gR.png?1" rel="nofollow"><img src="https://forum.elixirforum.com/uploads/default/optimized/2X/b/b9f2bbb3c4fa18d284e56dd61735037691b43a5d_2_690x319.png" alt="http://i.imgur.com/VAys8gR.png?1" width="690" height="319" srcset="https://forum.elixirforum.com/uploads/default/optimized/2X/b/b9f2bbb3c4fa18d284e56dd61735037691b43a5d_2_690x319.png, https://forum.elixirforum.com/uploads/default/optimized/2X/b/b9f2bbb3c4fa18d284e56dd61735037691b43a5d_2_1035x478.png 1.5x, https://forum.elixirforum.com/uploads/default/original/2X/b/b9f2bbb3c4fa18d284e56dd61735037691b43a5d.png 2x" data-dominant-color="F9F9F9"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">http://i.imgur.com/VAys8gR.png?1</span><span class="informations">1363×631 31.3 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div><p></p>
<p>I have no idea what is going on, and my files seem to be the same as yours (with some caveats, like encrypted_password instead of password_hash)</p>
<p>Here is the plug</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule Vulkan.Web.Context do
  @behaviour Plug
 
  import Plug.Conn
 
  def init(opts), do: opts
 
  def call(conn, _) do
    case Guardian.Plug.current_resource(conn) do
      nil -&gt; conn
      user -&gt;
        put_private(conn, :absinthe, %{context: %{current_user: user}})
    end
  end
end
</code></pre>
<p>The router</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule Vulkan.Router do
  use Vulkan.Web, :router

  pipeline :api do
    plug :accepts, ["json"]
  end
  
  pipeline :graphql do
    plug Guardian.Plug.VerifyHeader, realm: "Bearer"
    plug Guardian.Plug.LoadResource
    plug Vulkan.Web.Context
  end

  scope "/api" do
    pipe_through :graphql
    
    forward "/", Absinthe.Plug,
      schema: Vulkan.Schema
  end

  forward "/graphiql", Absinthe.Plug.GraphiQL,
    schema: Vulkan.Schema

end
</code></pre>
<p>The post resolver</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule Vulkan.PostResolver do
  alias Vulkan.{ Repo, Post }
  import Ecto.Query, only: [where: 2]
  
  def all(_args, %{context: %{current_user: %{id: id}}}) do
    posts =
      Post
      |&gt; where(user_id: ^id)
      |&gt; Repo.all
   
    {:ok, posts}
  end
  
  def all(_args, _info) do
    {:error, "Unauthorized"}
  end
end
</code></pre>
<p>The session model</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule Vulkan.Session do
  alias Vulkan.User
 
  def authenticate(params, repo) do
    user = repo.get_by(User, email: String.downcase(params.email))
    case check_password(user, params.password) do
      true -&gt; {:ok, user}
      _ -&gt; {:error, "Incorrect login credentials"}
    end
  end
 
  defp check_password(user, password) do
    case user do
      nil -&gt; false
      _ -&gt; Comeonin.Bcrypt.checkpw(password, user.encrypted_password)
    end
  end
end
</code></pre>
<p>I have no idea of why it doesn’t work, being the same codebase it should, any ideas?</p>
<p><strong>EDIT</strong> I’m pretty dumb, was doing requests to /graphql instead of /api <img src="https://forum.elixirforum.com/images/emoji/apple/laughing.png?v=15" title=":laughing:" class="emoji" alt=":laughing:" loading="lazy" width="20" height="20"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="22299" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/phoenix-graphql-tutorial-with-absinthe-authentication-with-guardian/2766/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-22299" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="22299"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #11"></div>
  </section>
</div>
    <div class="postbit" id="22384" data-post-id="22384">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="ryanswapp" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/ryanswapp/120/304_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  ryanswapp
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Sorry to just get to this. It looks like you figured out the issue (sending requests to wrong route). Is that right? Happy to help if you are still having trouble.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="22384" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/phoenix-graphql-tutorial-with-absinthe-authentication-with-guardian/2766/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-22384" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="22384"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #12"></div>
  </section>
</div>
    <div class="postbit" id="22385" data-post-id="22385">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Oxyrus" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Oxyrus/120/842_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Oxyrus
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Yes I did, that was exactly the problem, stupid me <img src="https://forum.elixirforum.com/images/emoji/apple/smile.png?v=15" title=":smile:" class="emoji" alt=":smile:" loading="lazy" width="20" height="20">, thank you.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="22385" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/phoenix-graphql-tutorial-with-absinthe-authentication-with-guardian/2766/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-22385" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="22385"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #13"></div>
  </section>
</div>
    <div class="postbit" id="22426" data-post-id="22426">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="mkunikow" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/mkunikow/120/235_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  mkunikow
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Sorry if not related to topic.<br>
It seems that meteor js team is also moving to Graph QL.<br>
Worth consider listen what they are doing <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"><br>
<a href="https://devchat.tv/js-jabber/jsj-246-graphql-and-apollo-with-uri-goldshtein" class="onebox" target="_blank" rel="noopener nofollow ugc">https://devchat.tv/js-jabber/jsj-246-graphql-and-apollo-with-uri-goldshtein</a></p><aside class="onebox allowlistedgeneric" data-onebox-src="https://www.apollographql.com/">
  <header class="source">
      <img src="https://www.apollographql.com/favicon/android-icon-192x192.png" class="site-icon" alt="" width="192" height="192">

      <a href="https://www.apollographql.com/" target="_blank" rel="noopener nofollow ugc">apollographql.com</a>
  </header>

  <article class="onebox-body">
    <div class="aspect-image" style="--aspect-ratio:690/361;"><img src="https://www.apollographql.com/og.png" class="thumbnail" alt="" width="690" height="369"></div>

<h3><a href="https://www.apollographql.com/" target="_blank" rel="noopener nofollow ugc">The API Orchestration Platform for AI Agents, Web, and Mobile Apps</a></h3>

  <p>Connect agents and apps to GraphQL and REST APIs with proven infrastructure trusted by enterprise leaders.</p>


  </article>

  <div class="onebox-metadata">
    
    
  </div>

  <div style="clear: both"></div>
</aside>
 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="22426" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/phoenix-graphql-tutorial-with-absinthe-authentication-with-guardian/2766/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-22426" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="22426"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-last-post cat-last-post" title="Last post!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>