pass data to app after redirect

I am building an app using react native. The app allows users to login using social network websites. For multiple reasons, I decided to build the flow manually instead of using an SDK.

The flow is as follows:

  1. The user will click on the login button from the frontend

  2. backend will redirect to the social network site

  3. after logging in the backend will handle the response and create the user, etc...

  4. Now i would like to redirect the user back to the app i.e (appname://login_successful).

my question is what is the best way to return the user data, tokens, etc.. ?

Is it safe to return it through the url? (appname://login_successful?user_id=1&name=mark&access_token=234&refresh_token=63445....)

or maybe I should return some code/token (appname://login_successful?code=123) and then the frontend could do a POST request to the backend to retrieve the data? (will require an additional request)

Also is there an advantage in using WebView instead of opening the url in safari?

Thanks a lot