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 .

no one who wants to answer me? :frowning_face::sweat:

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

There’s also this thread that might help:

2 Likes