class SpaApplication
A class representing configuration settings for a single-page application (SPA), specifically managing redirect URIs used in OAuth/authentication flows.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/applications/spa.py
5 - 9
simple
Purpose
This class encapsulates the configuration for a single-page application within the Office365 API context. It inherits from ClientValue, making it a data transfer object that can be serialized and sent to Office365 services. The primary responsibility is to manage and store redirect URIs that are used during OAuth authentication flows for SPAs. These URIs specify where users should be redirected after authentication.
Source Code
class SpaApplication(ClientValue):
"""Specifies settings for a single-page application."""
def __init__(self, redirect_uris=None):
self.redirectUris = StringCollection(redirect_uris)
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
ClientValue | - |
Parameter Details
redirect_uris: An optional collection of redirect URIs (URLs) that the single-page application will use for OAuth authentication callbacks. Can be None, a list of strings, or any iterable containing URI strings. These URIs must be registered with the identity provider and match exactly during authentication flows.
Return Value
Instantiation returns a SpaApplication object with a redirectUris attribute containing a StringCollection of the provided redirect URIs. The class itself doesn't have methods that return values, but the instance can be used as a ClientValue in Office365 API operations.
Class Interface
Methods
__init__(self, redirect_uris=None)
Purpose: Initializes a new SpaApplication instance with optional redirect URIs for OAuth authentication flows
Parameters:
redirect_uris: Optional collection of redirect URI strings. Can be None, a list, or any iterable of strings representing valid URLs
Returns: None (constructor)
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
redirectUris |
StringCollection | A collection of redirect URIs used for OAuth authentication callbacks. Stores the URLs where users will be redirected after authentication in the single-page application | instance |
Dependencies
office365
Required Imports
from office365.runtime.client_value import ClientValue
from office365.runtime.types.collections import StringCollection
Usage Example
from office365.runtime.client_value import ClientValue
from office365.runtime.types.collections import StringCollection
class SpaApplication(ClientValue):
def __init__(self, redirect_uris=None):
self.redirectUris = StringCollection(redirect_uris)
# Create an SPA application with redirect URIs
redirect_urls = [
'https://myapp.example.com/callback',
'https://myapp.example.com/auth/redirect'
]
spa_app = SpaApplication(redirect_uris=redirect_urls)
# Create an SPA application without redirect URIs
spa_app_empty = SpaApplication()
# Access the redirect URIs
print(spa_app.redirectUris)
Best Practices
- Always provide valid, registered redirect URIs that match your application's OAuth configuration
- Redirect URIs should use HTTPS in production environments for security
- The redirect_uris parameter accepts None, which creates an empty StringCollection
- This class is typically used as part of larger Office365 application registration or configuration operations
- As a ClientValue subclass, instances are meant to be serialized and sent to Office365 services, not for complex business logic
- Do not modify the redirectUris attribute directly after instantiation; create a new instance if URIs need to change
- Ensure redirect URIs are properly formatted URLs before passing them to the constructor
Tags
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class WebApplication 76.1% similar
-
class PublicClientApplication 72.4% similar
-
class ApiApplication 64.0% similar
-
class Configuration 59.3% similar
-
class SPACSServicePrincipalInfo 57.1% similar