question

LucaBortolotti-4744 avatar image
0 Votes"
LucaBortolotti-4744 asked azure-cxp-api edited

Can't verify Azure Web App domain against Google Domain Verification

I added to my web app the Google Login as described here: configure-authentication-provider-google
and I could follow all the steps, the problem is that when I tried to load the webapp, Google auth replied with an error.
The problem is that I have to verify the domain:

> APIs & Auth Domain verification You need to verify domain ownership to allow webhook notifications to be sent to your external domains. Google verifies that the user owns each of the listed domains via Search Console.

To do that I just have to add an HTML file gave by Google to my webapp root.

I did and I published the app, but the file, also if in the directory, still not accessible and Google can't validate the domain.

I noticed 2 issues:

First of all I had to force the publish of the file, it wasn't published automatically. See below:

7387-untitled.png

How to resolve it?

Second I forced the publishing of the file and I found it in the root as shown below:

7414-capture.png

But still not accessible here: googlef7d31af1ee37b43d.html

I tried to add:

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseStaticFiles();

.....

}

But it doesn't work anyway and I don't want free access to all static file in the root, I have also the appsettings.json with the db connection strings there.

Thanks.


azure-webapps
untitled.png (63.6 KiB)
capture.png (56.9 KiB)
· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @LucaBortolotti-4744,

Your link is still returning 404 but I can't see why. I suggest enabling diagnostic logs to see if there any insights in the logs.


0 Votes 0 ·

Hi @ryanchill , maybe there's a way by code to "activate" the specific path of the resource? How can I say from code to make available that link?

0 Votes 0 ·
ryanchill avatar image ryanchill LucaBortolotti-4744 ·

I would set ASPNETCORE_ENVIRONMENT to Development and enable Diagnostic logging from the app service blade. The logging should provide a trace of the request. How are your routes configured @LucaBortolotti-4744? This is a web api project correct? The file should just be returned instead of returning a 404. You could add a controller method that will return the file.

 [Authorize]
 public IActionResult GoogleVerify()
 {
     var file = Path.Combine(Directory.GetCurrentDirectory(), "googlef7d31af1ee37b43d.html");
    
     return PhysicalFile(file, "text/html");
 }

I'm not sure though if this route will satisfy Google's requirement.

0 Votes 0 ·
Show more comments
LucaBortolotti-4744 avatar image
0 Votes"
LucaBortolotti-4744 answered ryanchill commented

Ok, I solved the problem.

I was using

 public void Configure(IApplicationBuilder app, IWebHostEnvironment env) 
 {
    .....
    
    app.UseStaticFiles();
    
    .....
 }

But my file wasn't under the folder wwwroot, actually I didn't have that folder, so:

  • I added a new folder

  • I named the folder as wwwroot and automatically was recognized as wwwroot and set with the specific icon (see image below)

  • I moved my file inside that folder

That's it... Sorry, but I'm new on this and I wasn't able to figure out this trivial issue!

7380-capture.png



capture.png (5.3 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Glad to see your issue resolved @LucaBortolotti-4744. I am curious of one thing though. When creating an ASPNET Core project in Visual Studio, it automatically adds the wwwroot folder to the project. Was this folder never available or was this project that was migrated from NETFX to NETCORE?

0 Votes 0 ·
LucaBortolotti-4744 avatar image
0 Votes"
LucaBortolotti-4744 answered

I solved the first question: It wasn't published automatically because "Build Action" was automatically set at "none".

I solved put it as "content", see below.


Still open the second question!

7436-capture.png



capture.png (24.5 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.