Human Connect can also be run in embedded mode, which is useful for some mobile applications and other non-standard environments where browser features are limited in some way. This includes applications built with PhoneGap/Cordova libraries.

The main difference of embedded mode is that **all callbacks are implemented as simple redirects**. The result is that users will not be directed outside of your application during authentication, but you will need to supply Human Connect with URLs for the finish and close functions.

In order to start the authentication process you can redirect your user to `https://connect.humanapi.co/embed` and add the following parameters into your query string:

ParameterTypeDescription
`client_id`StringThis is your client's or app's ID, you can get this from the app settings page.
`client_user_id`StringUser ID from your app. It can be email or any other internal id of the user in your system.
`public_token`StringThe `publicToken` received from previous user authentication (only for existing users).
`finish_url`StringUser is redirected to this URL when health data connection process is finished. `session_token` and `human_id` will be added as request parameters. The base of this URL must be: `https://connect.humanapi.co/blank/`
`close_url`StringUser is redirected to this URL if process cancelled or popup closed. The base of this URL must be: `https://connect.humanapi.co/blank/`

Create and Edit Mode

For **new users**, open the popup in Create Mode by supplying both `client_id` and `client_user_id` parameters.

For **existing users**, open the popup in Edit Mode by supplying `client_id`, `client_user_id`, and `public_token` as parameters.

See [Human Connect Overview](🔗) for more details.

Next, ensure that you monitor the connect popup web view for the close callbacks you passed in on launch. When you detect these urls, implement methods appropriate for finish or close.

Here's an example of what this might look like:





Keep in mind that the eventListener for callbacks will only work in the Cordova inAppBrowser. Therefore, you will need to test in the platform emulators (Xcode/AndroidStudio) instead of via the raw HTML files. In a desktop browser, you will see `{"statusCode"=200}` instead of a callback.

As soon as user is redirected to the `finish_url` you can finalize the authentication process on your server by exchanging the `sessionTokenObject` and retrieving a user's `accessToken`.

The server-side token exchange process is the same for all platforms. See the guide on [Finalizing User Authentication](🔗) guide to finish the process.