Synapsers.Oauth.Matterport is a reusable .NET library for integrating Matterport OAuth authentication into ASP.NET Core and Blazor applications. It provides a secure, extensible, and production-ready solution for handling Matterport OAuth flows, token storage, and user management, with or without ASP.NET Core Identity.
- Custom Matterport OAuth Handler: Full control over the OAuth flow, including login and callback endpoints.
- Blazor & ASP.NET Core Support: Works with both Blazor and traditional ASP.NET Core apps.
- Secure Token Storage: Store Matterport access/refresh tokens on the user entity.
- No Session/Correlation Cookie Dependency: Stateless custom flow for distributed/cloud scenarios.
- Centralized Configuration: All settings via
appsettings.jsonand strongly-typed options. - Extensible: Add custom claims, events, or logic as needed.
- Compatible with ASP.NET Core Identity: Integrates with Identity for user management and token persistence.
-
Go to the Matterport Developer Portal.
-
Register a new OAuth application.
-
Set the Redirect URI to match your app, e.g.:
https://localhost:7197/signin-matterport -
Note your Client ID and Client Secret for use in configuration.
Example:
Add the package to your project (NuGet coming soon):
# Example (when published)
dotnet add package Synapsers.Oauth"Matterport": {
"ClientId": "YOUR_CLIENT_ID",
"ClientSecret": "YOUR_CLIENT_SECRET",
"Scope": [ "ViewDetails", "ViewPublic" ]
}public class ApplicationUser : IdentityUser
{
public string? MatterportAccessToken { get; set; }
public string? MatterportRefreshToken { get; set; }
public DateTime? MatterportTokenExpires { get; set; }
}using Synapsers.Oauth.Matterport;
// ...existing code...
var matterportSection = builder.Configuration.GetSection("Matterport");
builder.Services.Configure<MatterportAppOptions>(matterportSection);
var matterportOptions = matterportSection.Get<MatterportAppOptions>() ?? new MatterportAppOptions();
builder.Services.AddAuthentication(options =>
{
options.DefaultScheme = "Matterport";
})
.AddMatterport(options =>
{
options.ClientId = matterportOptions.ClientId;
options.ClientSecret = matterportOptions.ClientSecret;
options.Scope.Clear();
foreach (var scope in matterportOptions.Scope ?? Array.Empty<string>())
options.Scope.Add(scope);
});
// ...existing code...- Use Blazor/Razor pages to start the OAuth flow and handle the callback.
- On callback, exchange the code for tokens, store them on the user, and sign in.
The src/TestApp project demonstrates a full integration:
- Custom login page:
/Account/StartMatterportLogin(Blazor) - Callback handler:
/signin-matterport(Blazor) - Token storage: On
ApplicationUserentity - Identity integration: Uses ASP.NET Core Identity for user management
- Configuration: All settings in
appsettings.json
See src/TestApp/readme.md for a step-by-step guide.
- Never commit real secrets to source control.
- For production, use secure secret storage (Azure Key Vault, environment variables, etc).
- Always use HTTPS in production.
Contributions are welcome! See CONTRIBUTING.md for details.
MIT License

