Skip to content

Matterport OAuth integration for ASP.NET Core & Blazor. Secure, extensible .NET library for authenticating users with Matterport, supporting custom OAuth flows, ASP.NET Core Identity, and seamless token management.

Notifications You must be signed in to change notification settings

SynapeResearchSystemsCorp/Synapsers.Oauth.Matterport

Repository files navigation

Synapsers - Matterport OAuth for ASP.NET Core & Blazor

Synapsers.Oauth.Matterport - Matterport OAuth Integration for ASP.NET Core & Blazor

GitHub Repo stars GitHub last commit Contributors NuGet version NuGet downloads

Overview

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.


Features

  • 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.json and 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.

Quick Start

1. Create a Matterport Developer Application

  • 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:

    Matterport App Registration Screenshot

2. Install the Library

Add the package to your project (NuGet coming soon):

# Example (when published)
dotnet add package Synapsers.Oauth

3. Configure Matterport OAuth in appsettings.json

"Matterport": {
  "ClientId": "YOUR_CLIENT_ID",
  "ClientSecret": "YOUR_CLIENT_SECRET",
  "Scope": [ "ViewDetails", "ViewPublic" ]
}

4. Extend Your Identity User (if using Identity)

public class ApplicationUser : IdentityUser
{
    public string? MatterportAccessToken { get; set; }
    public string? MatterportRefreshToken { get; set; }
    public DateTime? MatterportTokenExpires { get; set; }
}

5. Register the Handler in Program.cs

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...

6. Implement the Login and Callback UI

  • 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.

Example: TestApp

The src/TestApp project demonstrates a full integration:

  • Custom login page: /Account/StartMatterportLogin (Blazor)
  • Callback handler: /signin-matterport (Blazor)
  • Token storage: On ApplicationUser entity
  • 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.


Security Notes

  • Never commit real secrets to source control.
  • For production, use secure secret storage (Azure Key Vault, environment variables, etc).
  • Always use HTTPS in production.

Contributing & Support

Contributions are welcome! See CONTRIBUTING.md for details.


License

MIT License

About

Matterport OAuth integration for ASP.NET Core & Blazor. Secure, extensible .NET library for authenticating users with Matterport, supporting custom OAuth flows, ASP.NET Core Identity, and seamless token management.

Topics

Resources

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

No packages published