stackernews / stacker.news

Internet communities that pay you Bitcoin
https://stacker.news
MIT License
422 stars 106 forks source link

Cannot login PWA (iOS) with e-mail or Nostr #727

Open Sebastix opened 8 months ago

Sebastix commented 8 months ago

Description I'm not able to login with the PWA installed on my iOS device. I've linked my Nostr and email as auth methods.

Environment: If you only experience the issue on certain devices or browsers, provide that info.

Using Github Auth works for logging in (my least preferable way of loggin in). The Lightning auth method also doesn't work on my side. When I copy-paste the lnurld url in my Thunderhub client I get a success message but SN is returning Auth failed. Try again or choose a different method.

huumn commented 8 months ago

Thanks for creating an issue! Both the email (an ios only problem) and nostr requiring an extension are known to us but we haven't put them here to track yet afaik.

Lightning Auth should work. When it fails to link, it's usually because that lightning auth has been linked to another account.

Sebastix commented 8 months ago

@huumn I tried to login with Lightning in the past, but is was not connected to my account so I disconnected it. So yes, it could be linked to another SN account now (which I'm not using). How could I restore this?

ekzyis commented 8 months ago

Both the email (an ios only problem) and

I wonder if we could and should fix that by not only having a magic link as provided by Next-Auth but also a login code which iOS users can copy and manually paste into the PWA.

nostr requiring an extension are known to us

Not sure if this is fixable by us on mobile. I think someone needs to write a "nostr login app" or something which would open and sign an event if you click on a QR code like for LNURL-auth.

Or is it possible to have a nostr extension on mobile?

Lightning Auth should work. When it fails to link, it's usually because that lightning auth has been linked to another account.

We could mention that it might have failed because it was linked to another account in every case. So we wouldn't leak information about an account but just be more helpful in our error message.

huumn commented 8 months ago

I wonder if we could and should fix that by not only having a magic link as provided by Next-Auth but also a login code which iOS users can copy and manually paste into the PWA.

We can and we should yes. :)

Not sure if this is fixable by us on mobile.

We can do this by sending a DM with a magic link!

ekzyis commented 8 months ago

We can do this by sending a DM with a magic link!

Oof, DMs on nostr, don't get me started haha. But yes, I think this could indeed be a very nice way to login without compromising too much on security. I haven't considered using nostr DMs yet.

Sebastix commented 8 months ago

image

Too bad that a Safari extension (Nostore in action in iOS Safari above in the screenshot) is not working in a PWA for Nostr event signing

Sending a token to the user to be used in the PWA (such for logging in) seems to me the best solution for now.

I'm curious, is the Nostr auth part of the next-auth package?

huumn commented 8 months ago

I'm curious, is the Nostr auth part of the next-auth package?

We hacked it in as a credential provider.