expo AppAuth.exchangeCodeAsync is not a function

Please provide the following:

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

I have been using expo-auth-session for OAuth authentication for the BlueButton api.I have been able to get the authorization code via useAuthRequest function.

const [request, response, promptAsync] = useAuthRequest(
      issuer: "https://sandbox.bluebutton.cms.gov",
      clientId: "kbG5kRRrnQZuDqUri65x5bYcKGMUaV318BFT5rws",
      scopes: ["profile"],

      // For usage in managed apps using the proxy
      redirectUri: makeRedirectUri({ useProxy: false }),
      state: "<state>",

in response I am getting json object

Object {
  "error": null,
  "errorCode": undefined,
  "params": Object {
    "code": "LwdjiafqqOj9KDPT7u0EOvBfeiKHuA",
    "state": "<state>",
  "type": "success",
  "url": "exp://",

now I want to obtain the token via this authorization code,and I cant find any function in expo-auth-session API to obtain token after receiving the authorization code.

found a function on https://docs.expo.io/guides/authentication/

const { accessToken } = await AuthSession.exchangeCodeAsync(
    clientId: request?.clientId,
    code: result.params.code,
    extraParams: {
      // You must use the extraParams variation of clientSecret.
      // Never store your client secret on the client.
      client_secret: 'CLIENT_SECRET',
  { tokenEndpoint: 'https://www.strava.com/oauth/token' }

but upon using this function getting

undefined is not a function (near '...AuthSession.exchangeCodeAsync...')

can anybody explain is it possible via expo-auth-session to obtain token or what is a standard flow to obtain token upon receiving the authorization code.

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