@drmhse/authos-react 0.2.1 → 0.2.2

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/README.md CHANGED
@@ -146,10 +146,14 @@ Registration form for new users.
146
146
  <SignUp
147
147
  onSuccess={() => console.log('Check your email!')}
148
148
  onError={(error) => console.error(error)}
149
- orgSlug="my-org" // Optional: pre-fill organization
149
+ orgSlug="my-org" // Optional: override provider config
150
+ serviceSlug="my-app" // Optional: override provider config
150
151
  />
151
152
  ```
152
153
 
154
+ > [!NOTE]
155
+ > The `orgSlug` and `serviceSlug` props are optional and will fallback to the values configured in `AuthOSProvider`. Only use these props if you need to override the provider configuration for a specific use case.
156
+
153
157
  ### MagicLinkSignIn
154
158
 
155
159
  Sign-in component for Magic Links (passwordless).
package/dist/index.js CHANGED
@@ -568,6 +568,16 @@ function AuthOSProvider({ config, children, client: externalClient, initialSessi
568
568
  if (config.appearance?.variables) {
569
569
  applyVariables(config.appearance.variables);
570
570
  }
571
+ if (config.org && !config.service) {
572
+ console.warn(
573
+ '[AuthOS] You provided "org" but not "service". OAuth flows may not work correctly.'
574
+ );
575
+ }
576
+ if (!config.org && config.service) {
577
+ console.warn(
578
+ '[AuthOS] You provided "service" but not "org". OAuth flows may not work correctly.'
579
+ );
580
+ }
571
581
  }, [config.appearance]);
572
582
  const hasInitialToken = react.useRef(!!initialSessionToken);
573
583
  react.useEffect(() => {
@@ -946,8 +956,8 @@ function SignUp({
946
956
  await client.auth.register({
947
957
  email,
948
958
  password,
949
- org_slug: orgSlug,
950
- service_slug: serviceSlug
959
+ org_slug: orgSlug ?? config.org,
960
+ service_slug: serviceSlug ?? config.service
951
961
  });
952
962
  setIsSuccess(true);
953
963
  onSuccess?.();
package/dist/index.mjs CHANGED
@@ -567,6 +567,16 @@ function AuthOSProvider({ config, children, client: externalClient, initialSessi
567
567
  if (config.appearance?.variables) {
568
568
  applyVariables(config.appearance.variables);
569
569
  }
570
+ if (config.org && !config.service) {
571
+ console.warn(
572
+ '[AuthOS] You provided "org" but not "service". OAuth flows may not work correctly.'
573
+ );
574
+ }
575
+ if (!config.org && config.service) {
576
+ console.warn(
577
+ '[AuthOS] You provided "service" but not "org". OAuth flows may not work correctly.'
578
+ );
579
+ }
570
580
  }, [config.appearance]);
571
581
  const hasInitialToken = useRef(!!initialSessionToken);
572
582
  useEffect(() => {
@@ -945,8 +955,8 @@ function SignUp({
945
955
  await client.auth.register({
946
956
  email,
947
957
  password,
948
- org_slug: orgSlug,
949
- service_slug: serviceSlug
958
+ org_slug: orgSlug ?? config.org,
959
+ service_slug: serviceSlug ?? config.service
950
960
  });
951
961
  setIsSuccess(true);
952
962
  onSuccess?.();