AuthSession.startAsync empty return value

Please provide the following:

  1. SDK Version: 3.13.1
  2. Platforms(Android/iOS/web/all): Android
      let redirectUrl = await AuthSession.getRedirectUrl(); //this will be something like https://auth.expo.io/@your-username/your-app-slug
      let result = await AuthSession.startAsync({
        authUrl:
          'https://accounts.spotify.com/authorize' +
          '?response_type=code' +
          '&client_id=' +
          credentials.clientId +
          (scopes ? '&scope=' + encodeURIComponent(scopes) : '') +
          '&redirect_uri=' +
          encodeURIComponent(redirectUrl),
      })
console.log(result);

gives me this error

WARNING
00:16
[Unhandled promise rejection: ReferenceError: Can't find variable: result]

Stack trace:
  App.js:87:18 in getAuthorizationCode
  node_modules\regenerator-runtime\runtime.js:45:44 in tryCatch
  node_modules\regenerator-runtime\runtime.js:274:30 in invoke
  node_modules\regenerator-runtime\runtime.js:45:44 in tryCatch
  node_modules\regenerator-runtime\runtime.js:135:28 in invoke
  node_modules\regenerator-runtime\runtime.js:145:19 in PromiseImpl.resolve.then$argument_0
  node_modules\promise\setimmediate\core.js:37:14 in tryCallOne
  node_modules\promise\setimmediate\core.js:123:25 in setImmediate$argument_0
  node_modules\react-native\Libraries\Core\Timers\JSTimers.js:146:14 in _callTimer
  node_modules\react-native\Libraries\Core\Timers\JSTimers.js:194:17 in _callImmediatesPass
  node_modules\react-native\Libraries\Core\Timers\JSTimers.js:458:30 in callImmediates
  [native code]:null in callImmediates
  node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:407:6 in __callImmediates
  node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:143:6 in __guard$argument_0
  node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:384:10 in __guard
  node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:142:17 in __guard$argument_0
  [native code]:null in flushedQueue
  [native code]:null in callFunctionReturnFlushedQueue
  ...

The odd thing is that if I just open the link with Linking.openURL(), the flow is (seems?) correct. I can login and see the data that I want appended at the end of the URL, I just cannot get it from AuthSession.

I added a scheme, but it shouldn’t matter since I am just using an emulated app, right?

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