Skip to content

Descope Reactnative Redirect URI not recognized in production #22

@wuxiaohua1011

Description

@wuxiaohua1011

I followed the tutorial on https://docs.expo.dev/guides/authentication/#descope. It says that i can use the below for redirectURI

const redirectUri = AuthSession.makeRedirectUri();

it does work when I run the app using npx expo start

However, when I submit to app store, it just says

{"errorCode":"E011003","errorDescription":"Request is invalid","errorMessage":"The redirect_uri field must have a hostname","message":"The redirect_uri field must have a hostname"}

Below is my code

const descopeProjectId = "xxxxxx";
const descopeUrl = `https://api.descope.com/${descopeProjectId}`;
const redirectUri = AuthSession.makeRedirectUri();

export default function SignupOrLogin() {
    const [authTokens, setAuthTokens] = React.useState(null);
    const [userInfo, setUserInfo] = React.useState(null);
    const discovery = AuthSession.useAutoDiscovery(descopeUrl);
    const [userProfile, setUserProfile] = useState<UserProfile>({} as UserProfile)

    const [request, response, promptAsync] = AuthSession.useAuthRequest(
        {
            clientId: descopeProjectId,
            responseType: AuthSession.ResponseType.Code,
            redirectUri,
            usePKCE: true,
            scopes: ["openid", "profile", "email"],
        },
        discovery
    );

I have attempted to search online for something else, but I'm not quite sure what to substitude for redirectUri.

Thanks a lot for your help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions