This article describes how to use access tokens in HTTP requests to access protected resources such as Sitefinity Web API.
NOTE: This approach is valid only for projects that use the OpenID authentication protocol. For projects on the Default authentication protocol, you must configure Oauth2. For more information, see Configure Oauth2.
You need to perform the following:
Bearer access_token
Following are two samples demonstrating how to configure your applications with Sitefinity CMS and acquire an access token using the Resource owner flow and the Implicit flow. You can also take a look at the sample MVC application, which can obtain access tokens from Sitefinity CMS with implicit flow and can call the Sitefinity CMS Web API at the GitHub repository.
Perform the following:
testApp
NOTE: If you have an external project, you must install the official IdentityModel NuGet package. You do not need to do this, if you have already installed Progress.Sitefinity.Authentication NuGet package
IdentityModel
Progress.Sitefinity.Authentication
For more information about Endpoints, supported by IdentityServer 3, see the following:
Microsoft.Owin
Microsoft.Owin.Host.SystemWeb
Microsoft.Owin.Security.Cookies
Microsoft.Owin.Security.OpenIdConnect
Startup.cs
NOTE: You can configure the STS endpoint to be different from http://yoursitefinitysite/Sitefinity/Authenticate/OpenID/connect. To do this, navigate to Administration » Settings » Advanced » Authentication » SecurityTokenService » ServicePath.
In this tutorial, you create HTTP requests to access Sitefinity CMS OData services using access tokens with Bearer token authentication. To do this, you use a JavaScript OpenID Connect (OIDC) client OAuth2 protocol support for client-side applications.
In this tutorial, you enable users, authenticated in the backend, to obtain access token and have permissions to view News items via a protected service. You can additionally implement other actions authenticated users can complete, such as modify or delete.
The files you work with in this tutorial are:
NOTE: In this tutorial, you work with specific versions of the files, listed above. You can download these file versions from the GitHub repository.
Make sure the authentication protocol is set to OpenID (the default authentication protocol in Sitefinity CMS):
To setup the application and create HTTP requests:
NOTE: By default, assets are copied to the root folder of your application.
NOTE: By default, the links direct to the root folder.
The URL for the page containing the code handling the silent renew.
The type of response desired from the OIDC/OAuth2 provider.
Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.
This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.
This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.
The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important