Hello @Venkata S (Student)
To secure your Azure Function app using Google OAuth2, you need to follow a few steps.
First, you need to register your application with Google. You can follow the instructions in this article: https://docs.microsoft.com/en-us/azure/app-service/configure-authentication-provider-google.
Next, you need to add the Google information to your application in the Azure portal. You can follow the instructions in the same article mentioned above.
After that, you need to update your function code to require authentication. You can do this by changing the authLevel
parameter in the @HttpTrigger
annotation to AuthorizationLevel.Function
. Regarding the error you are seeing, it seems like you are trying to send an auth token to an untrusted domain.
You need to make sure that the domain you are sending the token to is configured to receive auth tokens. You can check the allowed external redirect URLs in your Google Identity Provider configuration to make sure that the domain you are sending the token to is listed there.
To test your function in the Azure portal, you can use the Code + Test feature. You can supply the query parameter and header with the authorization token from Postman. To test using Postman, you need to make sure that you are sending the token to the correct domain.
You can also check the allowed external redirect URLs in your Google Identity Provider configuration to make sure that the domain you are sending the token to is listed there.
I hope this helps