I am facing issue on Firefox for Teams APP authentication. I have a Configurable Tab which is a Blazor web application. In the Tab, you sign in using an Oauth provider which is not Azure Ad. On browser login works as expected but when open in Teams using Teams app, It never passes the authentication cookies from login pop up to calling page. To make it work on firefox , I have to disable Enahnced tracking protection. I understand that Firefox disabled Iframe to Iframe cookies passing, but does anyone know if there is a way I can handle it in better way without diabling this feature.
This works on Edge and Chrome without disabling any feature. Here is the code from startup.cs file:
services.AddAuthentication(options =>
{
options.DefaultScheme = CookieScheme;
options.DefaultChallengeScheme = OAuthScheme;
options.DefaultAuthenticateScheme = CookieScheme;
options.DefaultSignInScheme = CookieScheme;
})
.AddCookie(CookieScheme, options =>
{
options.Cookie.SecurePolicy = CookieSecurePolicy.Always;
options.Cookie.SameSite = SameSiteMode.None;
options.ExpireTimeSpan = TimeSpan.FromMinutes(9.5);
options.SlidingExpiration = false;
options.Events = new CookieAuthenticationEvents
{
OnValidatePrincipal = RefreshTokenIfRequired
};
})
.AddOAuth(OAuthScheme, options =>
{
var Settings = JsonConvert.DeserializeObject<ApiSettings>(Configuration["oauth"]);
options.ClientId = Settings.ClientId;
options.ClientSecret = Settings.ClientSecret;
options.AuthorizationEndpoint = Settings.AuthEndpoint;
options.TokenEndpoint = Settings.TokenEndpoint;
options.CallbackPath = new PathString("/oauth/callback");
options.SaveTokens = true;
});