Questions tagged [guardian]

Guardian is a token based authentication library for use with Elixir applications.

Guardian is a token based authentication library for use with Elixir applications.

Guardian remains a functional system. It integrates with Plug, but can be used outside of it. If you're implementing a TCP/UDP protocol directly, or want to utilize your authentication via channels in Phoenix, Guardian is your friend.

46 questions
0
votes
1 answer

Guardian.Plug.VerifyHeader do nothing if no token / wrong token

From router: pipeline :possibly_authorized do plug(:fetch_session) plug( Guardian.Plug.Pipeline, module: BoilerplateWeb.Guardian, error_handler: BoilerplateWeb.AuthErrorController ) plug…
Nema Ga
  • 2,450
  • 4
  • 26
  • 49
0
votes
1 answer

Forward args from custom plug to second plug

I have a custom plug that looks like this: defmodule Db.Auth.GuardianPipeline do use Guardian.Plug.Pipeline, otp_app: :db, module: Db.Auth.Guardian plug Guardian.Plug.VerifySession, claims: %{"typ" => "access"} plug…
steventnorris
  • 5,656
  • 23
  • 93
  • 174
0
votes
1 answer

Sending a graphql response from Guardian error handler when using Absinthe

I have a Phoenix app with Absinthe for a Graphql API. Guardian is used to authenticate requests that provide a Bearer token in the header. This is all working great until an invalid token is provided. I have specified an error handler in my Guardian…
harryg
  • 23,311
  • 45
  • 125
  • 198
0
votes
2 answers

** (UndefinedFunctionError) function Guardian.Plug.authenticated?/1 is undefined or private

I am very new to Elixir and Phoenix, I am trying to authenticate my application using {:comeonin, "~> 4.0"} and {:guardian, "~> 1.0"} and have a helper function that checks if the user is logged in: defmodule Chatter.ViewHelper do def…
Sabyasachi Ghosh
  • 2,765
  • 22
  • 33
0
votes
1 answer

(RuntimeError) `module` not set in Guardian pipeline . How to fix this?

Github link of my project. The Tutorial I am following This is error on my terminal for api(phoenix server) [error] #PID<0.560.0> running Slicker.Endpoint terminated Server: localhost:4000 (http) Request: POST /api/users ** (exit) an exception…
Ankit Dwivedi
  • 95
  • 1
  • 1
  • 9
0
votes
1 answer

JWT issued before application image rebuild does not work after image build/deploy

My app uses a SPA client and Phoenix/Elixir backend, with jwt authentication (via Guardian library). The app is deployed using Docker on GCP. I'm having the below issue: I'm an authenticated user that has been issued a jwt. Everything works…
Murcielago
  • 1,030
  • 1
  • 14
  • 24
0
votes
1 answer

Checking if user is authenticated in Phoenix templates

I am working on a phoenix application. The authentication part is implemented with Guardian. Like a typical web site, the app has a header, footer, and a sidebar. These are static pages in the layout folder. tree view -lib |--admin_app_web …
Arjun Singh
  • 677
  • 6
  • 18
0
votes
0 answers

Guardian.Plug.current_resource(conn) returns nil

I am updating Guardian from v0.14 to v1.0. I am following update guide from official guardian github page and I faced one problem. In order to update, I slightly changed my authentication logic. From: case…
D.R
  • 829
  • 4
  • 16
  • 30
0
votes
1 answer

Issue with Guardian - EnsureAuthenticated not working

I'm attempting to get Guardian auth work for my application. But I'm completely stuck and can't find any support for the problem I'm having. As far as I know I've setup Guardian exactly how the documentation shows how, but when I test…
Bitwise
  • 8,021
  • 22
  • 70
  • 161
0
votes
1 answer

API Authentication Test with Guardian

I'm trying to test my controller but I keep hitting a guardian "Unauthenticated" error. I think I know where it's going wrong but I'm just not sure why it's not working. Here is what I have. setup %{conn: conn} do user = insert(:user) …
Bitwise
  • 8,021
  • 22
  • 70
  • 161
0
votes
1 answer

Failling authentication

I have a phoenix app where I want to secure all the routes except the login and user creation route. To achieve this, I use the Guardian and ComeOnIn packages. (I tried to follow this blog) I managed to send a token to the client in the session…
Shimu
  • 1,137
  • 11
  • 25
0
votes
1 answer

Guardian let the user to get to the controller even when current_user is nil?

If user sends a token which is not expired however that specific user is no longer exist, Guardian still let user to get to the controller. I have added {:ok, nil} in the current_user.ex and it simply kill the connection which I don't think is the…
Mr H
  • 5,254
  • 3
  • 38
  • 43
0
votes
1 answer

Validating id with Guardian 1 and Phoenix 1.3

I use Guardian 1 and Phoenix 1.3. And I'm trying to make an API that uses JWT. I now have authentication working for routes. For example, you cannot access get api/users/ without having a valid token in the header. I have a pipeline that looks…
user6719137
0
votes
3 answers

Authenticate JWT with Guardian 1 and Phoenix 1.3

Ive made a project that can be found here: https://github.com/rootkc/phx_auth_api When I try to post to: http://0.0.0.0:4000/api/login with the body: { "user": { "username": "kenneth", "password": "kenneth" } } That is a user that is in the…
user6719137
0
votes
1 answer

Guardian DB Initial Setup (MyApp.Repo.insert/1 is undefined)

I am attempting to use guardian 0.14 and guardian_db 0.8 with elixir/phoenix. However, I keep running into the following error in the hooks: [error] #PID<0.983.0> running Api.Endpoint terminated Server: localhost:4000 (http) Request: POST…
steventnorris
  • 5,656
  • 23
  • 93
  • 174