Umbrella sharing session with Guardian?

it was a big job, but almost finished moving my application from Phoenix 1.2 -> 1.3, but I hit some walls :slight_smile:
Now have an umbrella with 3 apps, app (schema’s), web (html) & web_api (for ajax calls).

I use guardian, for signing in and out and now the problem arise the the web app cannot access the web_api part.
Guardian.Plug.current_resource(conn) is always nil. :nerd_face:

I tried to set the Plug.Session (store: :cookie, :signing_salt & :domain) parameters and the secret in the config equal for both apps, but without any luck.

Is issuer the same in both configs?

the other work-around is to create an Auth application, and include it as a dependency in your other apps. Probably the proper way to handle it.

I was trying to do $.ajax calls with jQuery.
this was solving the problem, because the web_api was on a different port

$.ajaxSetup({
  xhrFields: {
    withCredentials: true
  }
});
1 Like

Were your web apps being server on different subdomains? We’re trying to do a similar setup, but not sure how to go about it.