Interface IPreviewTokenGenerator
Generates and verifies preview tokens for content preview functionality.
Namespace: Umbraco.Cms.Core.Preview
Assembly: Umbraco.Core.dll
Syntax
public interface IPreviewTokenGenerator
Remarks
Preview tokens allow users to preview unpublished content by generating secure, time-limited tokens that can be verified on subsequent requests.
Methods
View SourceGenerateTokenAsync(Guid)
Generates a preview token for the specified user.
Declaration
Task<Attempt<string?>> GenerateTokenAsync(Guid userKey)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | userKey | The unique key of the user requesting the preview token. |
Returns
| Type | Description |
|---|---|
| Task<Attempt<string>> | An attempt containing the generated token string on success, or a failure result. |
VerifyAsync(string)
Verifies a preview token and returns the associated user key.
Declaration
Task<Attempt<Guid?>> VerifyAsync(string token)
Parameters
| Type | Name | Description |
|---|---|---|
| string | token | The preview token to verify. |
Returns
| Type | Description |
|---|---|
| Task<Attempt<Guid?>> | An attempt containing the user key on success, or a failure result if the token is invalid or expired. |