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
3
votes
1 answer

Authentication with csrf_token in Phoenix / Elixir

I am doing a project where the front-end is managed with Vue.js and the back with elixir / phoenix framework for my api. I need to manage the authentication of my users using csrf-token and JWT. I am using guardian library for the jwt part…
Cracho
  • 43
  • 4
3
votes
1 answer

Controller testing with Guardian

I have authenticated routes within my application and now I'm getting to the point of controller testing these endpoints. But I first need to authorize my request before I can test the API endpoint. Here is my test: setup %{conn: conn} do …
Bitwise
  • 8,021
  • 22
  • 70
  • 161
2
votes
1 answer

User does not persist after begin logged in

I am building my first Elixir app using Guardian and I am having an issue where a User can log in and be authenticated, but upon redirect to the next page the conn no longer stores the user information and Guardian.Plug.is_authenticated? returns…
michjo
  • 407
  • 2
  • 17
2
votes
1 answer

Elixir Guardian custom header verification instead of Authorization

I have two tokens coming to my Endpoint method. one with inside the key of Authorization and another one inside App-token but couldn't find any docs/support or anything to workaround this. what is the possible workaround to validate/verify both…
Radio Active
  • 449
  • 6
  • 18
2
votes
0 answers

IE11 is very slow on HTTPS sites

We have an internal web application and since short, it is very slow in IE11. Chrome and Firefox do not have this problem. We have an HTTP version of the same website, and this is fast with up to 6 concurrent HTTP sessions to the server and session…
1
vote
2 answers

ModelNotFoundError: No module named 'guardian.shortcuts'

I am trying to run a Django project, I tried to import assign_perm and remove_perm from guardian.shortcuts (code listed here: from guardian.shortcuts import assign_perm, remove_perm). and got an error: ModuleNotFoundError: No module named…
RA.IBOY
  • 69
  • 1
  • 7
1
vote
1 answer

How can I revoke Guardian access token in Elixir

How to revoke Guardian access token? The documentation: https://hexdocs.pm/guardian/Guardian.Token.Jwt.html#revoke/4 says that it should be implemented with GuardianDB callback, but I have no idea how it should be.
Vadym
  • 149
  • 1
  • 9
1
vote
1 answer

Detect GameGuardian Installed on the Android/Prevent Game Guardian from modifying values

Good day. I am trying to find a way to detect game guardian apk installed on the Android OS. Google didn't give any answers so I came here. The issue is that Game Guardian is installing different apk on it's initial launch with some random package…
VA Entertaiment
  • 575
  • 2
  • 7
  • 20
1
vote
1 answer

Guardian.Plug.EnsurePermissions is unrecognized

I am attempting to implement permissions-based security in my Phoenix app using Guardian. I've found examples online, but when I try to implement them, I can't get past this error: ** (UndefinedFunctionError) function…
Danny Ellis Jr.
  • 1,674
  • 2
  • 23
  • 38
1
vote
2 answers

Problems with guardian - how generate access and refresh token in login

To invalidate JWTs, people use one of two methods blacklist/whitelist (with guardian_db). a refresh token (which allows regenerating access tokens) with a short expiring access token. I dont want to use guardian_db in my project. So, how i …
1
vote
1 answer

Elixir/Phoenix/Guardian - Assigning current_user in conn doesn't work for testing

If have some controllers like this def index(%{assigns: %{current_user: %User{} = current_user}}} = conn, params) do ## User exists end def index(conn, params) do ## No user exists end If I run this test, I expect it to call the first…
Peter R
  • 3,185
  • 23
  • 43
1
vote
2 answers

no function clause matching in Plug.Conn.resp/3

I am trying to respond with JSON after validating a GET request against a JWT token using Guardian. my test: describe "Show user if authenticated" do setup %{conn: conn} do {:ok, %User{} = user} = Riders.create_user(@create_attrs) …
CHsurfer
  • 1,304
  • 1
  • 15
  • 34
1
vote
1 answer

JSON extraction author guardian API

So, I'm trying to extract JSON from the Guardian newspaper API. Basically I can get everything except the author which is crucial. How do or what is a different way of extracting this. Many thanks in advance I'm new to all this and have asked…
user8339148
1
vote
1 answer

Guardian db not inserting record into database

My mix file contains {:guardian, "~> 1.0"}, {:guardian_db, "~> 1.1"}, and config contains config :my_app, MyApp.Guardian, issuer: "my_app", ttl: {30, :days}, allowed_drift: 2000, verify_issuer: true, # mix guardian.gen.secret (to…
Tanweer
  • 567
  • 1
  • 5
  • 17
1
vote
1 answer

Remember me functionality in Phoenix using Guardian

I'm developing a login system for a web application using Guardian to handle authentication. In my Guardian config i have ttl: {30, :days} User's token is stored in cookies by calling: defp login(conn, user) do conn |>…
Razinar
  • 727
  • 3
  • 13
  • 21
1
2 3 4