How can I obtain currentUser id without Parse?

Hey friends!
I recently removed Parse framework from my app so I can proceed with my custom implementation. However, app relied on PFUser.current to get currently signed in user. How can I get the parseUser.objectId without using Parse? I can get session token from Parse keychain without Parse, but how does Parse store PFUser.current?

a bit confused here. You say you removed the Parse framework from the app but yet you still want to get the parseUser.objectId? so are you saying you just want to use Parse as a backend without using any of the sdk to access it?

that’s gonna be tough i think as you would need to basically build your own SDK to access the database with all the auth checks and queries which the sdk’s are for.

The Parse db is basically a MongoDB (or PostgreSQL). If you know how to access it, you can use other ways to pull the data.

but let’s wait for the experts to weigh in.

You should use some state management tool or manage your own state and save the logged in user to state, you also may want to save auth data locally to restore auth status on app startup. And when you need current user, read the logged in user from state.

I want to remove parse dependency in an upcoming update. There’s a logic that relies on getting signed in user by calling PFUser.current. I wonder if this user’s raw data (as json, for instance) can be obtained without using Parse framework. Otherwise I may need to issue an update that will store user id in keychain/defaults.
I can obtain session token directly via keychain API by calling parse service id, so thought that it’s also possible :blush: keeping parse framework only to get one string seems to be extremely wasteful.

You might have to try reverse engineer the iOS SDK. The original creators of the SDK are no longer active in this project, and the iOS SDK has not received significant updates in a while as people are generally switching to the Swift SDK. @cbaker6 might have more knowledge on how the iOS SDK stores currentUser.

1 Like

If you want to sign up and receive JSON responses from the Parse Server, you should use the REST API.

What @jayson said is true. Almost all of the Client SDK’s use the REST API with the exception of GraphQL based SDK’s. You will be recreating the wheel if use REST directly along with having to deal with tricky items like: keychain, pointers, roles, etc. If you have already removed the Objective C SDK, but you still plan to use Parse in a Swift based app to query, save, etc., it’s recommended you use the Swift SDK. Look at the playground examples and api docs

Thanks! I don’t plan to use Parse anymore - I only need to obtain PFUser.current() id, that’s all. So my strategy was to reverse-engineer implementation, but first wanted to make sure that there’s no other way for that(maybe it’s also stored in keychain or defaults). Because to get access token I don’t need to use parse framework, but I also need to have signed in user id.