We are excited to announce the following two additions to the wix-users-backend API. emailUser( ) The backend emailUser( ) function can be used to send a triggered email to any of your site's members. It works just like the frontend emailUser( ), without the restriction of only being able to send emails to the currently logged in user.
To learn more, see emailUser( ) in the API reference.
generateSessionToken( )
The generateSessionToken( ) function is used to bypass Wix member authentication so that you can use a 3rd party service to authenticate your users. That means you can provide Single Sign-On (SSO) for users where they are authenticated by a non-Wix entity to login to your Wix site.
To learn more, see generateSessionToken( ) in the API reference.
Calling wixUsers.generateSessionToken('someone@example.com') in backend jsw always return error "Unauthorized to perform this action with context ApiContext". Does anyone know how to authorize that API call? Thank you!
Yes, backend
Hi Stephen,
Finally this turned to be working:
wixUsers.emailUser(“emailID”,user._owner)
Peter
Your link emailUser( ) directs to an example where everything is clear, but the most important thing is missing.
let userId = // get user ID
How to get the user ID, if it is not the current user? I have tried the _owner field, but the email function does not work.
wixUsers.emailUser("emailID", user._owner)
Any idea how to get the user ID of a non logged in member?
Sam, this might be what I need to have my users login ONLY with Google. Just 2 things:
1) in the API-doc example code there´s this:
import {authBy3rdParty} from 'backend/authentications';
But I cannot find this backend function anywhere. What did I miss?
2)does this SSO REPLACE the Wix interface (the Wix login dialog) when a page is requested that is restricted (e.g. because Wix looks for a backend file called "login.jsw"), or is it just to make your own page, but, if a user somehow accesses a resticted page WITHOUT having logged on using a custom login page, the standard Wix login dialog is still displayed?