Welcome to the Kinde community

Updated 7 hours ago

Seamless access to web app from mobile app

Hi, I have two applications: a mobile app (Android) and a web app (built with Next.js). Users log in to the mobile app, and on one of the screens, there’s a button that redirects them to the web app. I want the users to seamlessly access the web app without needing to re-authenticate, as they are already logged into the mobile app. I attempted to use the token exchange grant type to achieve this, but it doesn’t seem to be supported.
Could you suggest an approach or solution?

P
R
5 comments

Hey @Rudolf Erasmus,
Good to hear from you.

Sorry that you are having issues switching between applications.
I don't see anything wrong with your implementation.

I would suggest having a read of the following doc: https://docs.kinde.com/authenticate/manage-authentication/user-auth-applications/

If the following doc doesn't solve your issue, would you be able to send a recording of your experience over? This will help my teammates replicate your issue.

Hi Oli!! thanks let me have a look!

Hi Oli, thanks for the documentation you provided!

Does it work between an Android/IOS Mobile App and a web app? When I tried it I got the "Hey fiend! Welcome back" screen. We are using a WebView in Android to connect to the NextJs site.

I went through the documentation link you provided, very carefully 😛

Create two or more Kinde apps.
- Android App. (This uses the Android SDK)
- Web App
Enable the same authentication method for both apps.
- Android App
- Password connections - Email + Password
- Web App
- Password connections - Email + Password

Is this what is meant by the authentication method ?

In each app, create a link to the other app using the applicable login method. You might do this using an application switcher, for example.
- Does this refer to the login link, for example I would like to login to the Web App (NextJs, which is hosted on http://10.0.2.2:3000/) `http://10.0.2.2:3000/api/auth/login` or is it just the app base path `http://10.0.2.2:3000/ ?

I created a simple page just to test and didn't get the token or the authed state.

export default async function WalletPage({
  searchParams,
}: {
  searchParams: Promise<Record<string, string | undefined>>;
}) {
  const { isAuthenticated, getAccessTokenRaw } = getKindeServerSession();
  const isAuthed = await isAuthenticated();
  const kindeToken = await getAccessTokenRaw();

  return (
    <div className="flex flex-col flex-wrap gap-2">
      <div>
        <h3>Token</h3>
        <span className="text-red-500">{kindeToken}</span>
      </div>
      <div>
        <h3>Is Authed</h3>
        <span className="text-red-500">{isAuthed ? "Yes" : "No"}</span>
      </div>
    </div>
  );
}

Hey Rudolf,
Sorry for the delayed response.

Looks like you have done everything right.
I will have to speak to my teammates on this issue and get back to you when I have more information.

Thanks @Oli - Kinde !

Add a reply
Sign up and join the conversation on Slack