Prompt a user login

To prompt a user login, first install weasl on your pubic website, then run the code

var userPromise = weasl.login();

weasl.login will return a promise that will resolve to either the logged in user, or undefined. Here's an example of what you can do with that:


if the user logs in successfully, it will output something that looks like this:

  "id": "26c749e6-a27b-4398-ae97-1e63c6318a53",
  "identity": {
    "email": "",
    "phone_number": "5555555555"
  "activity": {
    "last_login_at": null,
    "created_at": "Mon, 20 Aug 2018 01:45:08 GMT",
    "updated_at": "Mon, 20 Aug 2018 01:45:08 GMT"
  "attributes": {
    "name": {
      "value": "Ryan",
      "trusted": false,

if the user cancels the login, the promise will throw an error:

// User cancelled login


Did this help answer your question?

thumbs up
thumbs down

Thanks for the feedback! 🙏🏽

Help by drift