AspNetCore-WebApi | Professional REST API design with ASP.NET Core and WebAPI | REST library
kandi X-RAY | AspNetCore-WebApi Summary
kandi X-RAY | AspNetCore-WebApi Summary
Professional REST API design with ASP.NET Core and WebAPI
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of AspNetCore-WebApi
AspNetCore-WebApi Key Features
AspNetCore-WebApi Examples and Code Snippets
Community Discussions
Trending Discussions on AspNetCore-WebApi
QUESTION
Found very few direct hits on this issue with this sample. Either the sample is relative new or updated and no one has tried it or I am clearly doing something incorrect. Running this in Windows 10 using the latest VSCode. I am new to Azure (recently certified in Fundamentals) and somewhat new to the .Net world. Both could be working against me.
I have followed the instructions found here multiple times but get the same result. The full stack trace, FWIW, is
...ANSWER
Answered 2021-Apr-13 at 03:58I downloaded the sample code and get it works on my side, this is my Azure AD App configs:
For service Azure AD APP config:
App ID: a6b73b06-450a-4fac-a7bb-569c3644594c
For client Azure AD APP config:
App ID: d2a53db5-da38-47b7-97f1-2d27a9dd056d
Service project applications.json
settings:
QUESTION
Im getting 2 different errors on calling my login() function which looks like this:
...ANSWER
Answered 2021-Feb-01 at 17:22To resolve this error, you need to set the redirect URI used in your app to be of type "Single Page Application" in the Azure Portal.
QUESTION
I'm currently working on Azure AD authenticaton integration to Angular - .Net core 3.1 project. This is a project which was generated from Visual Studio 2019 template (ASP.NET Core Web App).
In Azure portal, I registered 2 application and configured by MS tutorial and this.
Two registed app:
- frontend_app (client id: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx16e3)
- backend_api (client id: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxfcc1)
But I published only one App service, which contains both SPA and API. After login, I got a token, which append to every api call with MSAL interceptor.
The problem is all of the calls return is: 401, due to 'audience is invalid'. in the auth token the audience value the client id of frontend_app.
How can I solve to accept the the audience? Is it correct to use 2 app registration for only one app service?
...ANSWER
Answered 2020-Dec-07 at 10:01As I said in the comment, the 401 error is usually because your audience does not match the api you want to call, so you need to make sure that your target audience is your api, in your question it should be your backend_api, I Use auth code flow to make a simple demonstration for you:
Parse the token:
QUESTION
I have been working through this tutorial:
https://github.com/Azure-Samples/ms-identity-javascript-angular-spa-aspnetcore-webapi
The Authentication works fine.
However, I get a CORS exception in the console:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://localhost:44351/api/todolist/. (Reason: CORS request did not succeed).
In startup.cs I changed:
// builder.AllowAnyOrigin() // .AllowAnyMethod() // .AllowAnyHeader();
to:
builder.WithOrigins("http://localhost:4200") .AllowAnyMethod() .AllowAnyHeader() .AllowCredentials();
This had no effect.
Can anyone help me to resolve please?
Here is the startup.cs
...ANSWER
Answered 2020-May-25 at 08:47I have tried all the methods you tried, as well as other methods, and encountered the same problem in this project. More details can be found in the official documentation. According to the instructions in the official documentation, the cross-domain solutions you tried before are all achievable, and I think the problem may appear in this sample project. If you re-create the demo, there will be no such problems. https://docs.microsoft.com/en-us/aspnet/core/security/cors?view=aspnetcore-3.1
In the end, the suggestion I gave was to set up CORS
on the portal, and I personally tested it to solve this problem.
In addition, if you need to trace the root of the problem, it is recommended to use the packet capture method for analysis, check the request header of the two websites, you can refer to the document .
QUESTION
I think my main question is which Authentication flow should I be using - On-Behalf-Of or Implicit Grant Flow? However my Authentication and Authorization set up in Startup.cs
could be wrong and I am way off, so apologies if so.
I have an existing Angular SPA in Azure and a Net Framework API also running in Azure.
The web API has been ported to Net Core 3.1.
In our Azure directory, I have two registered apps. One for the API, and the other for the SPA. I have added the SPA client ID under authorized clients in the WEB API.
It is worth noting that the App services are actually running in a different directory (I think this if fine but just mentioning)
Here is the relevant Authentication/Authorization setup in Azure AD.
...ANSWER
Answered 2020-May-09 at 02:06You should be using implicit flow and msal-angular. It supports Angular from 4 to 9. Also I would not recommend using vanilla libraries in Angular unless there is no other choice.
ADAL is deprecated and does not support the converged application model (work+personal accounts) so you need to move to MSAL.
Follow Create web APIs with ASP.NET Core and Migrate from ASP.NET Core 2.2 to 3.0 to remove code like this:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install AspNetCore-WebApi
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page