Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sign in with apple is doesn't work with react native #2216

Closed
thoth-seshat opened this issue Sep 1, 2023 · 10 comments · Fixed by #2716
Closed

Sign in with apple is doesn't work with react native #2216

thoth-seshat opened this issue Sep 1, 2023 · 10 comments · Fixed by #2716
Assignees
Labels
bug Something isn't working

Comments

@thoth-seshat
Copy link

Describe the bug
I'm attempting to use Sign in with Apple with nhost. When I attempt to call: nhost.auth.signIn({ provider: "apple" }); I get an error:

Possible Unhandled Promise Rejection (id: 1):
TypeError: Cannot set property 'href' of undefined

I've configured the nhost client as directed in the docs with an identifier, callback urls, team ids etc.

To Reproduce
React Native with expo v48
Steps to reproduce the behavior:

  1. Go through the nhost docs to configure sign in with apple, make sure your dashboard is all configured
  2. Set up an nhost client via their js sdk
  3. Attempt to sign in with apple nhost.auth.signIn({ provider: "apple" });
  4. See the following error:
 WARN  Possible Unhandled Promise Rejection (id: 0):
TypeError: Cannot set property 'href' of undefined
TypeError: Cannot set property 'href' of undefined

Expected behavior
I'd expect to see an option to log in with apple.

Screenshots
Screenshot 2023-09-01 at 3 44 59 PM

Desktop (please complete the following information):

  • OS: iOS Simulator 14
  • Version React Native 48

Additional context
I've been having a discussion in Discord and was told I'm using the React SDK instead of the JS one however, this is not the case. I'm directly using the JS sdk now.

I've also pulled my config from the nhost dashboard locally and that doesn't seem to help. I'm able to get Auth working fine with Firebase Auth but want to keep everything in nhost. I'll also note, I'd probably just use the API to set everything up but there is no documentation on how authentication works in nhost (that I'm aware of) it's more like, go code diving in our repository and figure it out). which is starting to take it's toll on productivity since I can't really just look things up.

Anyway, I've lost the better part of week on this problem and so am trying here. Has anyone been able to get login working with React Native and Nhost?

@thoth-seshat thoth-seshat added the bug Something isn't working label Sep 1, 2023
@georgii-ivanov
Copy link

georgii-ivanov commented Oct 22, 2023

+1 for this issue.

Looks like they don't support React Native officially. IMO, they should have a fallback using react-native/expo Linking.

This issue is 2 mo. old and it's pretty sad for me it has still no reaction. Especially, when Apple enforces us to support Apple Sign In option along with others like Google Sign In.

Here's the source code:
image

Although, they support expo-session-storage to set session var.

It's unclear to me how to send a token obtained from the Google/Apple oAuth.

@pkreipke
Copy link

pkreipke commented Dec 5, 2023

I don't know if this will help (given the code ^^^ isn't checking whether window is defined) but as late as Jan '23 this worked for the RN app was working on at the time:

// KLUDGE for Nhost.io setup 'cause it's a React SDK not a RN SDK!
const prevWindow = window
window = undefined;

export const nhost = new NhostClient({
	subdomain: backendUrl,
	region: 'us-east-1',
	clientStorage: AsyncStorage,
	clientStorageType: 'react-native',
	autoRefreshToken: true,
	// refreshIntervalTime: 10, // These are seconds!
})

window = prevWindow

@pkreipke
Copy link

pkreipke commented Dec 5, 2023

One more note: while I love Nhost, RN support has been an issue for the 15 months before Jan '23 as well :-|. Though there are a few souls on Discord who are a great help!

@dbarrosop dbarrosop changed the title Sign in with apple is doesn't work with nHost Sign in with apple is doesn't work with react native Dec 5, 2023
@dbarrosop
Copy link
Contributor

Apologies for not responding. Unfortunately there are way too many frameworks and submodes within those frameworks with lots of different quirks and we have limited resources. As it is probably obvious we don't officially support react native at this point but we have plans to take a look into it during 2024Q1.

Again, apologies for not responding. Hopefully we can get this sorted soon.

@hadnet
Copy link

hadnet commented Feb 17, 2024

@dbarrosop so here we are 2024Q1, any updates? React Native is a huge community guys and providing support will be a giant bonus. I'm using Clerk because this lack of RN support, unfortunately.

@dbarrosop
Copy link
Contributor

No updates yet, this work is scheduled for late March (assuming priorities don't change due to unforeseen circumstances). In the meantime, people can leverage the API directly while we try to make our sdk compatible with react native. Given that everything is opensource, PRs are also more than welcomed. Sorry and thanks for your patience.

@Salman9000
Copy link

No updates yet, this work is scheduled for late March (assuming priorities don't change due to unforeseen circumstances). In the meantime, people can leverage the API directly while we try to make our sdk compatible with react native. Given that everything is opensource, PRs are also more than welcomed. Sorry and thanks for your patience.

Hello, using the api for signup-email-password the url given in the documentation is https://local.auth.nhost.run/v1/signup/email-password

I am unable to use this api when i replace local with my subdomain

@dbarrosop
Copy link
Contributor

dbarrosop commented Mar 11, 2024

you may be missing the region if you are only replacing the subdomain, for instance:

https://asdasdasdasd.auth.eu-central-1.nhost.run/v1/signup/email-password

@Salman9000
Copy link

you may be missing the region if you are only replacing the subdomain, for instance:

https://asdasdasdasd.auth.eu-central-1.nhost.run/v1/signup/email-password

Update: This url is working.

@onehassan
Copy link
Contributor

We are currently working on this. Stay tuned to updates here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants