You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After a user logs in we want to initialize this user: 1) set an extra user alias, 2) set user language and 3) add multiple tags. For security reasons, we want to do these kind of operations as much as possble through server side API calls, eg.:
We have learnt that function OneSignal.login only needs to be called once. How can we check whether a user has already logged in? This would also prevent duplicate initialization. We could not find a method for this or a way to read a user's external ID or aliasses.
We have learnt that function OneSignal.login only needs to be called once. How can we check whether a user has already logged in? This would also prevent duplicate initialization.
You may call OneSignal.login on every page load or just once, the SDK accounts for both use-cases this so it won't cause any issues.
We could not find a method for this or a way to read a user's external ID or aliasses.
Most of the SDK's APIs are write-only, this is to encourage your operations / data to be the source of truth. The SDK caches operations (functions you call) and ensures they are completed (accounts for network issues). However we understand that a success confirmation is important, so we are looking into providing a way in the future to get the success result. Let us know if you have any concerns of feedback for this.
As explained at #1094 (comment), we are trying to initialize a OneSignal user after loggin in. Without knowing client side whether a user has logged in or has been initialized, we do an API request to one of our endpoints, which does API requests to your endpoints. These requests can be skipped if we could tell client side whether a user is logged in or not.
If no method available, we can track a successful login + initialization using local storage as a workaround.
How can we help?
After a user logs in we want to initialize this user: 1) set an extra user alias, 2) set user language and 3) add multiple tags. For security reasons, we want to do these kind of operations as much as possble through server side API calls, eg.:
We have learnt that function
OneSignal.login
only needs to be called once. How can we check whether a user has already logged in? This would also prevent duplicate initialization. We could not find a method for this or a way to read a user's external ID or aliasses.Or is there a better way to initialize users? We could not find eg. a
user.created
webhook (https://documentation.onesignal.com/docs/webhooks).The text was updated successfully, but these errors were encountered: