beforeAuthcallback is executed when the user presses the Login or Register button after entering their email or phone number. A common use case for this would be collecting and validating additional user information when the user is registering for the first time.
beforeAuthcallback is set as a property on the element that accepts a function with the following prototype:
trueto continue with the registration/login, or return
falseto cancel the registration/login.
onSuccesscallback is executed when a user is successfully logged in. This allows you to customize the behavior for handling successful authentication. An example of this would be storing the authorization token to be used by your backend code, customizing where users should be redirected after a login, or setting other fields client-side.
onSuccesscallback is set as a property on the element that accepts a function with the following prototype:
onSuccesscallback, the auth token and redirect URL will be provided for use within the callback. The auth token will not be automatically stored for use in your application. Storing the auth token in a cookie, local storage, or memory is recommended since it will be required to authenticate all subsequent requests for a user.
onSuccesscallback might look like:
psg_auth_token) in a cookie and in local storage, then redirect to the app's redirect URL.