Strava Authentication goes to website, but should open in app [solved]

Please provide the following:

  1. SDK Version: 38
  2. Platforms(Android/iOS/web/all): all

Hopefully someone has already looked into this and can help me to incorporate Strava oauth. What should happen is that the user clicks on the connect with strava button and should be redirected to myApp after authorizing the app. However, strava says the redirectURL is invalid for the first 2 options (because it is a string that contains an expo URL even though it is a standalone managed workflow app). The third option with myApp is valid, but does not redirect the user back to the app or anything at all. The fourth option is valid, but the user is redirected to the website, which is of course not the goal.

const StravaAuth = (buttonProps: any) => {
  const { navigate } = useNavigation()
  const [request, response, promptAsync] = useAuthRequest(
      clientId: STRAVA_CLIENT_ID.toString(),
      scopes: ['read'],
      // For usage in managed apps using the proxy
      redirectUri: isMobile() ? makeRedirectUri({
        // For usage in bare and standalone
        native: 'veganfollowing://redirect',
        useProxy: false
      }) : '' // 'http://localhost:19006/stravaAuth'

  React.useEffect(() => {
    if (response?.type === 'success') {
      const { code } = response.params
      navigate('StravaAuth', {code})
  }, [response])

  return <AppButton
      backgroundColor: '#FC6100'
    onPress={() => promptAsync()}/>

export default StravaAuth

don’t have time at the moment to provide detailed info but read more about the useProxy option in the expo documentation


Thanks for the response. I’ve updated the code to use hooks and useProxy: true. However, this still does not work.

Setting useProxy false works on Android and iOS locally and in production. I had to make sure the scheme I used was in app.json and updated through the Play Store.

Glad to hear you got things sorted, @theplantbasedcompany. Good luck with your project moving forward!

1 Like