saasufy-components 9.5.3 → 9.6.1

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
@@ -345,7 +345,7 @@ A Saasufy component which integrates with data from Saasufy is known as a `socke
345
345
  - `url` (required): Specifies the URL for the Saasufy service to use as the data store for all components which are placed inside it.
346
346
  - `auth-token-name`: Allows you to specify a custom key for your token - This will be used as the key in localStorage. You generally do not need to set this attribute. It is intended for situations were an app has multiple `socket-provider` elements connecting different services with different/separate authentication flows.
347
347
  - `disable-tab-sync`: By default, the socket provider synchronizes socket auth state across multiple tabs via localStorage. If this attribute is set, then the socket auth state will not sync automatically and a manual page refresh may be necessary to update to the latest auth state.
348
- - `socket-options`: Can be used to set options on the inner `socket`. Must be in the format `option1:type1=value1,option2:type2=value2`; the type of each option can be string, boolean or number. If not specified, the default type is string.
348
+ - `socket-options`: Can be used to set options on the inner `socket`. Must be in the format `option1:type1=value1,option2:type2=value2`; the type of each option can be string, boolean or number. If not specified, the default type is string. Nested properties can be set like this: `autoReconnectOptions.initialDelay:number=2000,autoReconnectOptions.randomness:number=1000,autoReconnectOptions.multiplier:number=1.5,autoReconnectOptions.maxDelay:number=20000`.
349
349
  - `disconnect-on-deauth`: If this attribute is set, the underlying socket will be disconnected if the socket becomes unauthenticated. This means that components will not receive real-time updates until the user's next interaction (which will cause the socket to reconnect). If this attribute is not set, the socket will attempt to reconnect immediately after losing authentication.
350
350
  - `greedy-refresh`: If this attribute exists, the component will refresh itself whenever an attribute is set, even if that attribute's value did not change.
351
351
 
@@ -972,6 +972,8 @@ A link to initiate an OAuth flow to authenticate a user as part of log in. Can s
972
972
 
973
973
  - `provider` (required): The name of the provider. It must match the provider name specified on the `Authentication` page of your Saasufy control panel and also the value provided to the `oauth-handler` component at the end of the OAuth flow.
974
974
  - `client-id` (required): This is the client ID from the third-party OAuth provider.
975
+ - `redirect-uri`: A URI to redirect the user to once OAuth is successful. This attribute may be required depending on the OAuth provider/client.
976
+ - `grant-type`: The grant type for this OAuth flow. Typically set to `authorization_code`. This may be required depending on the OAuth provider/client.
975
977
  - `state-size`: This allows you to control the size (in bytes) of the random state string which is passed to the OAuth provider as part of the OAuth flow. Defaults to 20.
976
978
  - `state-storage-key`: The state string is stored in the browser's `sessionStorage` under this key. Defaults to `oauth.state`. It must match the value provided to the `oauth-handler` component at the end of the OAuth flow.
977
979
  - `use-session-storage`: By default, the state is stored inside localStorage. If this property is set, then the state will be stored inside sessionStorage instead. If set, this attribute should also be set on the related `oauth-handler` component.
@@ -998,6 +1000,7 @@ When using an OAuth provider, the callback URL which you register with the provi
998
1000
  - `provider` (required): The name of the provider. It must match the provider name specified on the `Authentication` page of your Saasufy control panel and also the value provided to the `oauth-link` component at the start of the OAuth flow.
999
1001
  - `success-location-hash`: If authentication is successful, the browser's `location.hash` will be set to this value. It can be used to redirect the user to their dashboard, for example.
1000
1002
  - `success-url`: If authentication is successful, the browser's `location.href` will be set to this value. It can be used to redirect the user to their dashboard, for example.
1003
+ - `redirect-uri`: A URI to redirect the user to once OAuth is successful. This attribute may be required depending on the OAuth provider/client.
1001
1004
  - `extra-data`: This attribute can be used to pass additional data to the OAuth `getAccessTokenURL` endpoint. For Google OAuth, for example, an additional `redirect_uri` field is required, so it should be set using `extra-data="redirect_uri=http://localhost.com:8000/"` (substitute the URI with your own).
1002
1005
  - `navigate-event-path`: If authentication is successful and a path is set via this attribute, the component will emit a `navigate` event which will bubble up the component hierarchy and can be used by a parent component to perform the success redirection. This approach can be used as an alternative to `success-location-hash` or `success-url` for doing the final redirect.
1003
1006
  - `state-storage-key`: The state string is stored in the browser's `sessionStorage` under this key. Defaults to `oauth.state`. It must match the value provided to the `oauth-link` component at the start of the OAuth flow.
package/oauth-handler.js CHANGED
@@ -62,6 +62,11 @@ class OAuthHandler extends SocketConsumer {
62
62
  let stateParamName = this.getAttribute('state-param-name') || 'state';
63
63
  let extraDataString = this.getAttribute('extra-data') || '';
64
64
  let { fieldValues: extraData } = convertStringToFieldParams(extraDataString);
65
+ let redirectURI = this.getAttribute('redirect-uri');
66
+
67
+ if (redirectURI) {
68
+ extraData.redirectURI = redirectURI;
69
+ }
65
70
 
66
71
  let authTimeout = Number(this.getAttribute('auth-timeout') || DEFAULT_AUTH_TIMEOUT);
67
72
  let urlSearchParams = new URLSearchParams(location.search);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "saasufy-components",
3
- "version": "9.5.3",
3
+ "version": "9.6.1",
4
4
  "description": "Components for Saasufy.",
5
5
  "main": "index.js",
6
6
  "scripts": {