Hello everyone. I am looking to see if there is a ...
# supabase-kt
c
Hello everyone. I am looking to see if there is a mechanism to retrieve a user from a jwt access token. My use-case is that I want to have a client send the token to my BE, which it will then retrieve the user from this token.
The documentation points to the option for "Fetch the user object using the access_token jwt", which points to this existing somewhere.
Oh I found it. The function is
retrieveUser
from the Auth instance, not Auth.admin.
Hello everyone! So back to this topic, I just realized that
retrieveUser
signs in the library to the JWT token. There is no equivalent from the admin library to go from JWT to user. Is anyone aware of any alternative?
j
What do you mean by > signs in the library The
retrieveUser
method only calls the API and returns the user, at no point is the user saved Code
c
Thanks for sharing that. When I was testing I saw that my BE code, was somehow signing as one of my users. I am thinking that it may be related to running two projects at the same time, both my client and BE code. For the JVM target, where are the information regarding the session stored? And once again, thanks for clarifying my question. You are the hero in all of this.
j
We use multiplatform-settings for storage. > On JVM, it uses the
Preferences
implementation with
Preferences.userRoot()
as a delegate The key, under which the session is stored, is determined by the Supabase URL. So unless that changed, it will point to the same value. You can however set the key yourself:
Copy code
install(Auth) {
    sessionManager = SettingsSessionManager(key = "myCustomKey")
}
K 2