Using own auth proxy instead of

SDK expo 47

Hello !
I made my own auth proxy following this doc AuthSession - Expo Documentation

Here the result with next

import { NextApiRequest, NextApiResponse } from 'next'
import { withAxiom } from 'next-axiom'

const handler = async (req: NextApiRequest, res: NextApiResponse) => {
  const params = req.query
  const innerURL = new URL(params.authServiceUrl?.toString() ?? '')
  const redirectURL = innerURL.searchParams.get('redirect_uri')
  if (params.authServiceUrl) {
    return res.redirect(decodeURIComponent(params.authServiceUrl.toString()))
  return res.redirect(redirectURL)
export default withAxiom(handler)

To use my own proxy I had to make some changes:

  • AuthSession.startAsync does not have args to overload the proxy url.

I tried to update my node_modules like this

diff --git a/node_modules/expo-auth-session/build/AuthSession.js b/node_modules/expo-auth-session/build/AuthSession.js
index 9a58a22..44cb66f 100644
--- a/node_modules/expo-auth-session/build/AuthSession.js
+++ b/node_modules/expo-auth-session/build/AuthSession.js
@@ -32,7 +32,8 @@ export async function startAsync(options) {
         return { type: 'locked' };
     const returnUrl = options.returnUrl || sessionUrlProvider.getDefaultReturnUrl();
-    const startUrl = sessionUrlProvider.getStartUrl(authUrl, returnUrl, options.projectNameForProxy);
+    // const startUrl = sessionUrlProvider.getStartUrl(authUrl, returnUrl, options.projectNameForProxy);
+    const startUrl = authUrl
     const showInRecents = options.showInRecents || false;
     // About to start session, set lock
     _authLock = true;

And it seems to work but I don’t trust this solution much

And lot of my users got a lot of problem on sign up and sign in with my proxy.

  1. How can I use AuthSession.startAsync with my own proxy?
  2. Is my proxy is right ?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.