middleware icon indicating copy to clipboard operation
middleware copied to clipboard

Help for using @hono/auth-js with React Native (Expo)

Open hasanaktas opened this issue 1 year ago • 5 comments

I am trying to integrate with react native.

I have exposed the api ends but I can't figure out how to send a request for login.

I need your help. The documentation is not clear at all and the example only works on nextjs.

screenshot


import { makeRedirectUri } from "expo-auth-session";
import * as Browser from "expo-web-browser";

const signIn = async () => {
  const redirectTo = makeRedirectUri();
  const signInUrl = `http://localhost:3000/api/auth/signin/google`;
  const result = await Browser.openAuthSessionAsync(signInUrl,redirectTo);
  console.log(result);
};


hasanaktas avatar Oct 07 '24 14:10 hasanaktas

in addition, normally when I send a get request here, shouldn't the http://localhost:3000/api/auth/signin/google login page come up? 400 Bad Request is returned.

My id and secrets are correct because they work in my @convex-dev/auth setup. (Again, a library built on authjs)

https://labs.convex.dev/auth

hasanaktas avatar Oct 07 '24 15:10 hasanaktas

@hasanaktas login page resides on http://localhost:3000/api/auth/signin you are using provider endpoint which is used for post request.

divyam234 avatar Oct 11 '24 07:10 divyam234

@divyam234

Unfortunately, I couldn't solve it. I tried many scenarios of post or get request but did not get any results. Only Google and Apple login was required. I integrate it as native and provide validation myself. Then I generate the access tokens myself.

This library needs to be documented properly.

hasanaktas avatar Oct 11 '24 14:10 hasanaktas

@hasanaktas goto https://next-auth-hono-react.pages.dev/api/auth/signin check this demo project you can see github login page.

divyam234 avatar Oct 11 '24 15:10 divyam234

Did you set up basePath or AUTH_URL? I had some trouble with missing configs before.

catnaut avatar Nov 13 '24 13:11 catnaut