workos / authkit-nextjs

The WorkOS library for Next.js provides convenient helpers for authentication and session management using WorkOS & AuthKit with Next.js.
MIT License
43 stars 9 forks source link

Property 'accessToken' does not exist on type 'UserInfo | NoUserInfo'.ts(2339) #54

Closed vinson14 closed 1 week ago

vinson14 commented 1 week ago

const { accessToken } = await getUser();

Attempted to retrieve the accessToken according to the example given in the documentation but it is resulting in a Typescript error.

Property 'accessToken' does not exist on type 'UserInfo | NoUserInfo'.ts(2339)

PaulAsjes commented 1 week ago

Hi there, which version of the library are you using?

vinson14 commented 1 week ago

I’m using 0.6.1

vinson14 commented 1 week ago

I noticed that in the library, accessToken is missing under NoUserInfo interface

PaulAsjes commented 1 week ago

I see the issue, it's missing from the interface as you mentioned: https://github.com/workos/authkit-nextjs/blob/main/src/interfaces.ts#L26-L32

I'll get a fix up soon.

vinson14 commented 1 week ago

Thanks for the help