keyboard_connection
keyboard_connection

Reputation: 41

Save password prompt disappears too quick on iOS (react native & expo-auth-session)

I'm using expo-auth-session package to authenticate using OpenID connect.

When the user is in the in-app safari web browser view and enter their email and password and presses login, the "Save password" modal appears for a split second before disappearing. It is never appearing again after this one time either.

(happens on iOS 17 and 18)

import * as AuthSession from "expo-auth-session";

public authenticate = async (): Promise<boolean> => {
    const discoveryData = await AuthSession.fetchDiscoveryAsync(
      idServerAppEndpoint
    );
    const authRequest = new AuthSession.AuthRequest({
      clientId: process.env.CLIENT_ID,
      redirectUri,
      scopes: ["openid", "offline_access"],
      responseType: "code",
      prompt: AuthSession.Prompt.Login,
    });
    const res = await authRequest.promptAsync(discoveryData);
    if (res.type === ResponeTypes.Success) {
      const { code } = res?.params || {};
      const { codeVerifier } = authRequest;
      const { access_token, refresh_token } = await this.getTokens(
        code,
        codeVerifier
      );
      await SecureStore.setItemAsync(StorageKeys.RefreshToken, refresh_token);
      await SecureStore.setItemAsync(StorageKeys.AccessToken, access_token);
      return true;
    }
    return false;
  };

Would could cause this? Is it a bug on the ID-server side or is there something wrong with the code I listed here?

I've tried adding timeouts before prompting, tried looking in the expo-auth-session documentation, but could not find any clues.

Upvotes: 0

Views: 27

Answers (0)

Related Questions