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
Sounds like you want SSO (Single Sign On)? Have you looked at something like:
There’s also this thread that might help:
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









