Hi everyone!
Hi, @marlowe-shaeffer ! Do you know is there any answer from the team? I’m experiencing the same issue - user need to reload page on after login.
Hi everyone!
Hi, @marlowe-shaeffer ! Do you know is there any answer from the team? I’m experiencing the same issue - user need to reload page on after login.
Hi @jay . I’m Gal from the Wix team.
Our developers weren’t able to reproduce the promptLogin() issue that you described earlier on this thread.
Can you please give it another try, and if the issue persists, share more details that will help us reproduce it?
I appreciate your cooperation!
@empro2pro @admin30811 Temporary solution.
Users don’t need to refresh the page.
Pages with permission - Members only
import { authentication, currentMember } from 'wix-members';
$w.onReady(function () {
authentication.onLogin((member) => {
currentMember.getMember(MemberOptions)
.then((member) => {
let loginEmail = member.loginEmail;
console.log(loginEmail)
return member;
})
});
Pages with permission - Everyone
import { authentication, currentMember } from 'wix-members';
let MemberOptions = {
fieldsets: ['FULL']
}
$w.onReady(function () {
currentMember.getMember(MemberOptions)
.then((member) => {
const loggedIn = member ? true : false;
if (loggedIn === false) {
let AuthOptions = {
mode: 'signup',
modal: true
}
authentication.promptLogin(AuthOptions)
.then(() => {
getMemberData()
})
} else {
getMemberData()
}
})
})
function getMemberData() {
currentMember.getMember(MemberOptions)
.then((member) => {
console.log(member)
return member;
})
.catch((error) => {
console.error(error);
});
}
Thank you for the response. I did a bit different - added a refresh in masterpage js on user login
@empro2pro Your issue solved?
@workiapps thanks for sharing the temp solution! I have it working right now by reverting back to the deprecated wix-users module. That seems to work fine for us right now. What you have makes sense though. If this isn’t resolved, maybe I can add that into a single file and export the result.
Thanks, @workiapps .
@admin30811 Glad you’ve found a temp solution while we continue to work on the issue. It looks like the fix won’t be rolled out until next week. I’m sorry for the delay, and I will let you know once it’s resolved!
@marlowe-shaeffer Just wanted to circle back on this. Any update from the dev team on a fix
@admin30811 Did you read the last of my posts (take a look onto the very end of this post).
https://www.wix.com/velo/forum/coding-with-velo/persistant-wix-authentication-wix-members-api-issue
@russian-dima I did! It was very helpful, and I appreciate you taking the time to try and sort out what’s going on with this. I think your conclusion was that the API still needed to be updated in some way (or at least the docs do). I was just checking in on that!
Hello,
This issue has been fixed. Please let us know if you continue to experience any errors. Thanks!
Hey @marlowe-shaeffer I just checked, and it still is not working. I see everyone else posting workarounds, so hopefully this isn’t redundant info, but just to explain the original problem.
Once a member logs into the site, I am unable to access “currentMember” object on any page until a hard refresh. Quick code example:
import { currentMember } from ‘wix-members’ ;
$w . onReady ( async function (){
let member = await currentMember . getMember ({ fieldsets : [ ‘FULL’ ]})
console . log ( member )
})
No matter which page this is added on, member is always returning as undefined until a hard refresh. Steps to reproduce:
Add the above code snippet to any random page
Log out of site
Log into the site
Navigate to page with this code snippet
You will see the log show ‘undefined’
Refresh the page
Now you should see the member object
Please advise. I want to reiterate that my site is not broken, I am using the deprecated wix-users module for this stuff for now. But it would be nice to move to the new module!
@admin30811 Oh no. Sorry about that! Thanks for letting me know. I’ve shared it with the dev team and will report back as soon as I have an update.
@admin30811 The development team looked into it and confirmed that there’s still an issue. I’m very sorry for this inconvenience, and I’ll let you know once it’s definitively fixed!
@marlowe-shaeffer No problem. I am glad they are at least able to reproduce the problem! Looking forward to hearing how it goes
@admin30811 This should now be resolved! Can you check and let me know? Thanks!
@marlowe-shaeffer Confirmed it is working as expected now. Thank you very much for your time and help with this Marlowe!
Excellent news! Thanks for your patience!
@marlowe-shaeffer I hate to do this, but actually it’s not 100% fixed. Seems to work perfectly fine for currentMember.getMember. But I am having the exact same issue now with currentMember.getRoles. It’s showing me as not being logged in after a login event. Ironically, I can pull the member object from getMember and then on the next line, the getRoles says I am not logged in.
Perhaps whatever was fixed for getMember needs to be applied here too?