auth.expo.io not redirecting back to app

Please provide the following:

  1. SDK Version: 40
  2. Platforms(Android/):
  3. Add the appropriate “Tag” based on what Expo library you have a question on.

Having issues when using expo-auth-session wth the auth.expo.io proxy enabled. At first i thought this was due to the specific OAuth provided i was using however I’ve just tested this with reddit with the same results.

Running app in android emulator (or android device) via Expo Go.

After authorising the redirect to auth.expo.io never directs back to the app.

App below created using a blank managed typescript.

import * as React from 'react';

import * as WebBrowser from 'expo-web-browser';

import { makeRedirectUri, useAuthRequest, AccessTokenRequest, exchangeCodeAsync } from 'expo-auth-session';

import { Button } from 'react-native';

WebBrowser.maybeCompleteAuthSession();

// Endpoint

const discovery = {

  authorizationEndpoint: 'https://www.reddit.com/api/v1/authorize.compact',

  tokenEndpoint: 'https://www.reddit.com/api/v1/access_token',

};

export default function App() {

  const [request, response, promptAsync] = useAuthRequest(

    {

      clientId: 'CLIENTID',

      scopes: ['identity'],

      redirectUri: makeRedirectUri({

        useProxy: true,

      }),

    },

    discovery

  );

  React.useEffect(() => {

    if (response?.type === 'success') {

      console.log('accessToken',response.params.code)

      

      const accessToken = new AccessTokenRequest({

        clientId: '8KoSXB_4dPI7lA',

        code: response.params.code,

        redirectUri: makeRedirectUri({

            native: 'communitygrocery.app://redirect', //only used when a native build

            useProxy: true,

        }),

    })

    const responseToken = exchangeCodeAsync(accessToken, discovery);

    console.log('responseToken', responseToken);

  }

  }, [response]);

  return (

    <Button

      disabled={!request}

      title="Login"

      onPress={() => {

        promptAsync();

        }}

    />

  );

}

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