How to integrate the AWS Congnito service with Blazor web assembly ?

Posted 3 years ago by chandraev
Edited 3 years ago
0

Hi All,

I am creating one POC to integrate the AWS cognito service on Blazor web assembly. Firstly i  did configuration of aws cognito service on AWS portal. then I tested on asp.net core 5.0 integration.

It is working fine there. Now i m trying to configure same things on Blazor web assembly. It is not working. It is giving below exception 

Refused to display 'URL of AWS Login page' in a frame because it set 'X-Frame-Options' to 'deny' in Blazor

I m doing like this in Blazor web assembly

Step 1: I m changing in Program file like this

 builder.Services.AddOidcAuthentication(options =>

           {

               // Configure your authentication provider options here.

               // For more information, see https://aka.ms/blazor-standalone-auth

               //builder.Configuration.Bind("Local", options.ProviderOptions);

               options.ProviderOptions.Authority = "https://cognito-idp.us-east-1.amazonaws.com/us-east-1_8Mv8GuFCL/.well-known/openid-configuration";

               options.ProviderOptions.ClientId = "1nu6k6dcopmlm7dp77jlko9s07";

               options.ProviderOptions.ResponseType = "code";

               options.ProviderOptions.RedirectUri = "https://localhost:44355/signin-oidc";

               options.ProviderOptions.PostLogoutRedirectUri = "";

           });

           builder.Services.AddApiAuthorization();

Step 2:  Running the application, then i m getting on  browser console 

 Refused to display 'https://mywebsite.auth.us-east-1.amazoncognito.com/login?client_id=1nu6k6dcopmlm7dp77jlko9s07&redirect_uri

=https%3A%2F%2Flocalhost%3A44355%2Fsignin-oidc&response_type=code&scope=openid%20profile&state

=3b161f4212f74d64974e89c9650975e8&code_challenge=8QWAbNHmmq7brEcH5N-i4AsF505gPt7FV6BQibblIQo&code_challenge_method=S256&prompt=none&response_mode=query'  

in a frame because it set 'X-Frame-Options' to 'deny'

 

Have any one fixed this type of issue ?  Any suggestion will be highly appreciated ? 

 

Someone is typing...

Post a Reply

You must be logged in to add a new post.
Number of online users: 0
An error has occurred. This application may no longer respond until reloaded. Reload 🗙