kinde-oss / kinde-auth-nextjs

Kinde NextJS SDK - authentication for server rendered apps
https://kinde.com/docs/developer-tools/nextjs-sdk/
MIT License
132 stars 17 forks source link

Bug: Property 'login' does not exist on type 'KindeState' #147

Open doow1 opened 2 months ago

doow1 commented 2 months ago

Prerequisites

Describe the issue

I am trying to setup a custom login page as described in the documentation with Nextjs

`import { useKindeAuth } from '@kinde-oss/kinde-auth-nextjs';

function SignInButton() { const { login } = useKindeAuth();

return (
    <button onClick={() => login({
        authUrlParams: {
            connection_id: "conn_e5f80aa5258e4685bf629b38003ee954",
            login_hint: "dave@kinde.com"
        }
    })}>
        Sign in with email
    </button>
);

}`

But i keep getting the error response

Property 'login' does not exist on type 'KindeState'.

at the point where i try importing the login method.

Library URL

https://github.com/kinde-oss/kinde-auth-nextjs

Library version

2.2.3

Operating system(s)

Windows

Operating system version(s)

Ubuntu linux

Further environment details

No response

Reproducible test case URL

No response

Additional information

No response

peterphanouvong commented 2 months ago

Hi @doow1, this article that I believe you are talking about is for React.

To do something similar with the Next.js SDK you should do something like:

import {LoginLink} from '@kinde-oss/kinde-auth-nextjs/components';
...

 <LoginLink
    authUrlParams={{
      connection_id: 'conn_e5f80aa5258e4685bf629b38003ee954',
      login_hint: 'dave@kinde.com'
    }}
  >
    Sign in with Phone
  </LoginLink>
brandanking-decently commented 1 month ago

Hey, I had this same issue which took me a while to discover a solution. It might be worth updating the docs to highlight the differences within the different SDK's