@supabase/gotrue-js 2.98.0 → 2.98.1-canary.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/lib/types.ts CHANGED
@@ -1774,6 +1774,255 @@ export interface GoTrueAdminOAuthApi {
1774
1774
  regenerateClientSecret(clientId: string): Promise<OAuthClientResponse>
1775
1775
  }
1776
1776
 
1777
+ /**
1778
+ * Type of custom identity provider.
1779
+ */
1780
+ export type CustomProviderType = 'oauth2' | 'oidc'
1781
+
1782
+ /**
1783
+ * OIDC discovery document fields.
1784
+ * Populated when the server successfully fetches and validates the
1785
+ * provider's OpenID Connect discovery document.
1786
+ */
1787
+ export type OIDCDiscoveryDocument = {
1788
+ /** The issuer identifier */
1789
+ issuer: string
1790
+ /** URL of the authorization endpoint */
1791
+ authorization_endpoint: string
1792
+ /** URL of the token endpoint */
1793
+ token_endpoint: string
1794
+ /** URL of the JSON Web Key Set */
1795
+ jwks_uri: string
1796
+ /** URL of the userinfo endpoint */
1797
+ userinfo_endpoint?: string
1798
+ /** URL of the revocation endpoint */
1799
+ revocation_endpoint?: string
1800
+ /** List of supported scopes */
1801
+ supported_scopes?: string[]
1802
+ /** List of supported response types */
1803
+ supported_response_types?: string[]
1804
+ /** List of supported subject types */
1805
+ supported_subject_types?: string[]
1806
+ /** List of supported ID token signing algorithms */
1807
+ supported_id_token_signing_algs?: string[]
1808
+ }
1809
+
1810
+ /**
1811
+ * Custom OAuth/OIDC provider object returned from the admin API.
1812
+ */
1813
+ export type CustomOAuthProvider = {
1814
+ /** Unique identifier (UUID) */
1815
+ id: string
1816
+ /** Provider type */
1817
+ provider_type: CustomProviderType
1818
+ /** Provider identifier (e.g. `custom:mycompany`) */
1819
+ identifier: string
1820
+ /** Human-readable name */
1821
+ name: string
1822
+ /** OAuth client ID */
1823
+ client_id: string
1824
+ /** Additional client IDs accepted during token validation */
1825
+ acceptable_client_ids?: string[]
1826
+ /** OAuth scopes requested during authorization */
1827
+ scopes?: string[]
1828
+ /** Whether PKCE is enabled */
1829
+ pkce_enabled?: boolean
1830
+ /** Mapping of provider attributes to Supabase user attributes */
1831
+ attribute_mapping?: Record<string, any>
1832
+ /** Additional parameters sent with the authorization request */
1833
+ authorization_params?: Record<string, string>
1834
+ /** Whether the provider is enabled */
1835
+ enabled?: boolean
1836
+ /** Whether email is optional for this provider */
1837
+ email_optional?: boolean
1838
+ /** OIDC issuer URL */
1839
+ issuer?: string
1840
+ /** OIDC discovery URL */
1841
+ discovery_url?: string
1842
+ /** Whether to skip nonce check (OIDC) */
1843
+ skip_nonce_check?: boolean
1844
+ /** OAuth2 authorization URL */
1845
+ authorization_url?: string
1846
+ /** OAuth2 token URL */
1847
+ token_url?: string
1848
+ /** OAuth2 userinfo URL */
1849
+ userinfo_url?: string
1850
+ /** JWKS URI for token verification */
1851
+ jwks_uri?: string
1852
+ /** OIDC discovery document (OIDC providers only) */
1853
+ discovery_document?: OIDCDiscoveryDocument | null
1854
+ /** Timestamp when the provider was created */
1855
+ created_at: string
1856
+ /** Timestamp when the provider was last updated */
1857
+ updated_at: string
1858
+ }
1859
+
1860
+ /**
1861
+ * Parameters for creating a new custom provider.
1862
+ */
1863
+ export type CreateCustomProviderParams = {
1864
+ /** Provider type */
1865
+ provider_type: CustomProviderType
1866
+ /** Provider identifier (e.g. `custom:mycompany`) */
1867
+ identifier: string
1868
+ /** Human-readable name */
1869
+ name: string
1870
+ /** OAuth client ID */
1871
+ client_id: string
1872
+ /** OAuth client secret (write-only, not returned in responses) */
1873
+ client_secret: string
1874
+ /** Additional client IDs accepted during token validation */
1875
+ acceptable_client_ids?: string[]
1876
+ /** OAuth scopes requested during authorization */
1877
+ scopes?: string[]
1878
+ /** Whether PKCE is enabled */
1879
+ pkce_enabled?: boolean
1880
+ /** Mapping of provider attributes to Supabase user attributes */
1881
+ attribute_mapping?: Record<string, any>
1882
+ /** Additional parameters sent with the authorization request */
1883
+ authorization_params?: Record<string, string>
1884
+ /** Whether the provider is enabled */
1885
+ enabled?: boolean
1886
+ /** Whether email is optional for this provider */
1887
+ email_optional?: boolean
1888
+ /** OIDC issuer URL */
1889
+ issuer?: string
1890
+ /** OIDC discovery URL */
1891
+ discovery_url?: string
1892
+ /** Whether to skip nonce check (OIDC) */
1893
+ skip_nonce_check?: boolean
1894
+ /** OAuth2 authorization URL */
1895
+ authorization_url?: string
1896
+ /** OAuth2 token URL */
1897
+ token_url?: string
1898
+ /** OAuth2 userinfo URL */
1899
+ userinfo_url?: string
1900
+ /** JWKS URI for token verification */
1901
+ jwks_uri?: string
1902
+ }
1903
+
1904
+ /**
1905
+ * Parameters for updating an existing custom provider.
1906
+ * All fields are optional. Only provided fields will be updated.
1907
+ * `provider_type` and `identifier` are immutable and cannot be changed.
1908
+ */
1909
+ export type UpdateCustomProviderParams = {
1910
+ /** Human-readable name */
1911
+ name?: string
1912
+ /** OAuth client ID */
1913
+ client_id?: string
1914
+ /** OAuth client secret (write-only, not returned in responses) */
1915
+ client_secret?: string
1916
+ /** Additional client IDs accepted during token validation */
1917
+ acceptable_client_ids?: string[]
1918
+ /** OAuth scopes requested during authorization */
1919
+ scopes?: string[]
1920
+ /** Whether PKCE is enabled */
1921
+ pkce_enabled?: boolean
1922
+ /** Mapping of provider attributes to Supabase user attributes */
1923
+ attribute_mapping?: Record<string, any>
1924
+ /** Additional parameters sent with the authorization request */
1925
+ authorization_params?: Record<string, string>
1926
+ /** Whether the provider is enabled */
1927
+ enabled?: boolean
1928
+ /** Whether email is optional for this provider */
1929
+ email_optional?: boolean
1930
+ /** OIDC issuer URL */
1931
+ issuer?: string
1932
+ /** OIDC discovery URL */
1933
+ discovery_url?: string
1934
+ /** Whether to skip nonce check (OIDC) */
1935
+ skip_nonce_check?: boolean
1936
+ /** OAuth2 authorization URL */
1937
+ authorization_url?: string
1938
+ /** OAuth2 token URL */
1939
+ token_url?: string
1940
+ /** OAuth2 userinfo URL */
1941
+ userinfo_url?: string
1942
+ /** JWKS URI for token verification */
1943
+ jwks_uri?: string
1944
+ }
1945
+
1946
+ /**
1947
+ * Parameters for listing custom providers.
1948
+ */
1949
+ export type ListCustomProvidersParams = {
1950
+ /** Filter by provider type */
1951
+ type?: CustomProviderType
1952
+ }
1953
+
1954
+ /**
1955
+ * Response type for custom provider operations.
1956
+ */
1957
+ export type CustomProviderResponse = RequestResult<CustomOAuthProvider>
1958
+
1959
+ /**
1960
+ * Response type for listing custom providers.
1961
+ */
1962
+ export type CustomProviderListResponse =
1963
+ | {
1964
+ data: { providers: CustomOAuthProvider[] }
1965
+ error: null
1966
+ }
1967
+ | {
1968
+ data: { providers: [] }
1969
+ error: AuthError
1970
+ }
1971
+
1972
+ /**
1973
+ * Contains all custom OIDC/OAuth provider administration methods.
1974
+ */
1975
+ export interface GoTrueAdminCustomProvidersApi {
1976
+ /**
1977
+ * Lists all custom providers with optional type filter.
1978
+ *
1979
+ * This function should only be called on a server. Never expose your `service_role` key in the browser.
1980
+ */
1981
+ listProviders(params?: ListCustomProvidersParams): Promise<CustomProviderListResponse>
1982
+
1983
+ /**
1984
+ * Creates a new custom OIDC/OAuth provider.
1985
+ *
1986
+ * For OIDC providers, the server fetches and validates the OpenID Connect discovery document
1987
+ * from the issuer's well-known endpoint (or the provided `discovery_url`) at creation time.
1988
+ * This may return a validation error (`error_code: "validation_failed"`) if the discovery
1989
+ * document is unreachable, not valid JSON, missing required fields, or if the issuer
1990
+ * in the document does not match the expected issuer.
1991
+ *
1992
+ * This function should only be called on a server. Never expose your `service_role` key in the browser.
1993
+ */
1994
+ createProvider(params: CreateCustomProviderParams): Promise<CustomProviderResponse>
1995
+
1996
+ /**
1997
+ * Gets details of a specific custom provider by identifier.
1998
+ *
1999
+ * This function should only be called on a server. Never expose your `service_role` key in the browser.
2000
+ */
2001
+ getProvider(identifier: string): Promise<CustomProviderResponse>
2002
+
2003
+ /**
2004
+ * Updates an existing custom provider.
2005
+ *
2006
+ * When `issuer` or `discovery_url` is changed on an OIDC provider, the server re-fetches and
2007
+ * validates the discovery document before persisting. This may return a validation error
2008
+ * (`error_code: "validation_failed"`) if the discovery document is unreachable, invalid, or
2009
+ * the issuer does not match.
2010
+ *
2011
+ * This function should only be called on a server. Never expose your `service_role` key in the browser.
2012
+ */
2013
+ updateProvider(
2014
+ identifier: string,
2015
+ params: UpdateCustomProviderParams
2016
+ ): Promise<CustomProviderResponse>
2017
+
2018
+ /**
2019
+ * Deletes a custom provider.
2020
+ *
2021
+ * This function should only be called on a server. Never expose your `service_role` key in the browser.
2022
+ */
2023
+ deleteProvider(identifier: string): Promise<{ data: null; error: AuthError | null }>
2024
+ }
2025
+
1777
2026
  /**
1778
2027
  * OAuth client details in an authorization request.
1779
2028
  * Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
@@ -4,4 +4,4 @@
4
4
  // - Debugging and support (identifying which version is running)
5
5
  // - Telemetry and logging (version reporting in errors/analytics)
6
6
  // - Ensuring build artifacts match the published package version
7
- export const version = '2.98.0'
7
+ export const version = '2.98.1-canary.0'