shahryarjb

shahryarjb

How to use guardian in 2 Phoenix sites

Hello , I need to validate Site1 request in Site2 when Site 1 needs to send to it , then I created 2 site by Phoenix.
for example the Site1 wants to send request like this :

{
  "country": "Australia",
  "email": "email@gmail.com",
  "language": "fa",
  "last_ip": "127.1.2.4",
  "lastname": "name",
  "name": "shahryar",
  "password": "password"
}

but I need it to be done like hash JWT (guardian), therefore I think I can use guardian, but I don’t know , how? because I am forced to write this code in these site :

config :api_trangell, ApiTrangell.Guardian,
  issuer: "api_trangell",
  allowed_algos: ["ES512"],
  secret_key: %{
    "alg" => "ES512",
    "crv" => "P-521",
    "d" => "5lzq86dlBivEqOmJj_6x_xW5lxY5bCAV1cxJ1Lt8fsshKAkHOz3j0iOF_ruG2PYXF69kDnY3HvSiY2tbog2UjBc",
    "kty" => "EC",
    "use" => "sig",
    "x" => "AIYZCBlSZ4jGvRHJnhWU_s85Uqu6Fl8F7TMMD1WjcibHIGIHfPjEwyfIdmAjvgMwKalqjhKIgqQEejvaPtxHwLMB",
    "y" => "AOogDP-U1x4VcgL0xUr7TEXc9FmQv3wvJ_goDW6ZJ_1PBebpOVltZP-3ydG1nAr-ddqoq9AFUQP9UhY3wQhvKFD_"
  }

Note : the config code was for testing .

but I don’t want to write private key in these site, The Site 1 should be encrypted by public key and site 2 can validate and read the variable in the key which was generated by public key.

how do I do like this ? these site were created by Phoenix
The data after encrypting in Site 1 should be sent to Site 2 .

thank you .

Most Liked

AstonJ

AstonJ

Sounds like you want SSO (Single Sign On)? Have you looked at something like:

There’s also this thread that might help:

Where Next?

Popular in Questions Top

9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
earth10
Hi, I’m just starting to build a side-project with Elixir and Phoenix and doing some basic test with Elixir alone. What strikes me is th...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New

Other popular topics Top

AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 31013 112
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
josevalim
Hi everyone, One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
saif
Hello everyone, Long time lurker first time poster here. I’ve recently begun working on Elixir full-time again! :raised_hands: It’s been...
New
KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 36352 110
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement