Skip to content

[🐛] Cannot login via facebook using firebase - Error: [auth/invalid-credential] The supplied auth credential is malformed or has expired. [ Invalid access_token, error code 43 ] #7126

@proactivebit

Description

@proactivebit

Issue

Hi Recently I started getting error "Invalid access_token, error code 43" when I want to login to the app using facebook option and firebase integration. Before that everything works. I haven't change anything. Right now facebook developer team turn off my application from production because of this. I checked configuration and it seems be ok.
When I do investigation I see that I get access token from facebook but when I send it to the firebase I get in response error 43. I also checked my other app and it looks that the problem is also visible there. Maybe it's some global problem?
logs:
LOG {"accessToken": "myaccesstoken", "accessTokenSource": "CHROME_CUSTOM_TAB", "applicationID": "myapplicationid", "dataAccessExpirationTime": 1692302693000, "declinedPermissions": [], "expirationTime": 1689683970908, "expiredPermissions": [], "lastRefreshTime": 1684526692908, "permissions": ["openid", "public_profile", "email"], "userID": "myuserid"}
LOG [Error: [auth/invalid-credential] The supplied auth credential is malformed or has expired. [ Invalid access_token, error code 43 ]]

Project Files

Javascript

Click To Expand

image

package.json:

{
  "name": "PuzzleTracker",
  "version": "4.1.8",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "info": "react-native info",
    "start": "react-native start",
    "start:clear": "react-native start --reset-cache",
    "test:all": "jest \"__tests__/.*\\.spec\\.js\" --detectOpenHandles",
    "test": "jest --detectOpenHandles",
    "lint": "eslint --ext .js,.jsx,.ts,.tsx src/",
    "detox:build": "detox build -c android",
    "detox:test": "detox test -r -c android",
    "release": "./android/gradlew bundleRelease",
    "pod:install": "arch -x86_64 pod install",
    "setup:env": "source $HOME/.bash_profile",
    "clean:android": "cd ./android && ./gradlew clean && cd ..",
    "clean:ios": "cd ./ios && xcodebuild clean && cd .."
  },
  "dependencies": {
    "@invertase/react-native-apple-authentication": "2.2.2",
    "@react-native-async-storage/async-storage": "1.17.11",
    "@react-native-camera-roll/camera-roll": "5.2.3",
    "@react-native-community/masked-view": "0.1.11",
    "@react-native-community/push-notification-ios": "1.10.1",
    "@react-native-firebase/analytics": "11.3.3",
    "@react-native-firebase/app": "11.3.3",
    "@react-native-firebase/auth": "11.3.3",
    "@react-native-firebase/crashlytics": "11.3.3",
    "@react-native-firebase/firestore": "11.3.3",
    "@react-native-firebase/functions": "11.3.3",
    "@react-native-firebase/in-app-messaging": "11.3.3",
    "@react-native-firebase/storage": "11.3.3",
    "@react-native-google-signin/google-signin": "6.0.1",
    "@react-navigation/drawer": "5.12.5",
    "@react-navigation/native": "5.9.4",
    "@react-navigation/stack": "5.14.5",
    "@reduxjs/toolkit": "^1.9.3",
    "add": "2.0.6",
    "date-fns": "2.22.1",
    "formik": "2.2.9",
    "i": "^0.3.6",
    "i18n-js": "3.8.0",
    "immutability-helper": "3.1.1",
    "lodash": "4.17.21",
    "nativewind": "^2.0.11",
    "qs": "6.11.0",
    "react": "18.2.0",
    "react-native": "0.71.3",
    "react-native-chart-kit": "6.11.0",
    "react-native-currency-input": "1.0.1",
    "react-native-date-picker": "4.2.8",
    "react-native-event-listeners": "1.0.7",
    "react-native-fbsdk-next": "11.2.0",
    "react-native-formik": "1.7.8",
    "react-native-fs": "2.18.0",
    "react-native-gesture-handler": "1.10.3",
    "react-native-get-random-values": "1.8.0",
    "react-native-iap": "12.7.3",
    "react-native-image-crop-picker": "0.39.0",
    "react-native-image-resizer": "1.4.5",
    "react-native-image-viewing": "0.2.2",
    "react-native-in-app-review": "3.2.3",
    "react-native-linear-gradient": "2.5.6",
    "react-native-localize": "2.2.4",
    "react-native-onboarding-swiper": "1.2.0",
    "react-native-pager-view": "5.4.25",
    "react-native-paper": "5.4.1",
    "react-native-push-notification": "7.4.0",
    "react-native-reanimated": "2.14.4",
    "react-native-safe-area-context": "3.2.0",
    "react-native-screens": "2.18.1",
    "react-native-share": "8.2.1",
    "react-native-snap-carousel": "3.9.1",
    "react-native-splash-screen": "3.2.0",
    "react-native-star-rating": "1.1.0",
    "react-native-svg": "12.1.1",
    "react-native-tab-view": "3.0.1",
    "react-native-timeline-flatlist": "0.7.6",
    "react-native-tracking-transparency": "0.1.1",
    "react-native-vector-icons": "7.1.0",
    "react-native-view-shot": "3.1.2",
    "react-redux": "^8.0.5",
    "realm": "11.4.0",
    "rn-fetch-blob": "0.12.0",
    "uuid": "8.3.2",
    "yarn": "1.22.10",
    "yup": "0.32.9"
  },
  "devDependencies": {
    "@babel/core": "7.20.12",
    "@babel/preset-env": "^7.20.0",
    "@babel/preset-typescript": "^7.18.6",
    "@babel/runtime": "7.20.0",
    "@react-native-community/eslint-config": "3.2.0",
    "@realm/babel-plugin": "^0.1.1",
    "@realm/react": "^0.4.1",
    "@testing-library/jest-native": "4.0.13",
    "@testing-library/react-native": "7.2.0",
    "@tsconfig/react-native": "^2.0.2",
    "@types/jest": "29.2.1",
    "@types/lodash": "4.14.191",
    "@types/qs": "6.9.7",
    "@types/react": "18.0.24",
    "@types/react-native": "0.63.40",
    "@types/react-native-onboarding-swiper": "1.1.4",
    "@types/react-native-push-notification": "^8.1.1",
    "@types/react-native-snap-carousel": "3.8.5",
    "@types/react-native-star-rating": "1.1.2",
    "@types/react-native-vector-icons": "6.4.13",
    "@types/react-redux": "^7.1.25",
    "@types/react-test-renderer": "18.0.0",
    "@types/redux-logger": "3.0.9",
    "@types/uuid": "8.3.4",
    "@typescript-eslint/eslint-plugin": "5.52.0",
    "@typescript-eslint/parser": "5.52.0",
    "babel-jest": "29.2.1",
    "babel-plugin-dynamic-import-node": "2.3.3",
    "babel-plugin-module-resolver": "4.1.0",
    "detox": "18.18.1",
    "detox-getprops": "0.1.2",
    "eslint": "8.19.0",
    "eslint-config-codingitwrong": "0.1.4",
    "eslint-import-resolver-babel-module": "5.3.2",
    "eslint-import-resolver-typescript": "2.4.0",
    "eslint-plugin-detox": "1.0.0",
    "eslint-plugin-jest": "^27.2.1",
    "eslint-plugin-react": "7.24.0",
    "eslint-plugin-react-hooks": "^4.6.0",
    "jest": "29.2.1",
    "jest-circus": "26.6.3",
    "metro-react-native-babel-preset": "0.73.7",
    "moment": "2.29.4",
    "prettier": "2.4.1",
    "react-native-modal": "13.0.0",
    "react-native-set-version": "1.1.2",
    "react-test-renderer": "18.2.0",
    "reactotron-react-native": "^5.0.3",
    "reactotron-redux": "^3.1.3",
    "tailwindcss": "^3.2.7",
    "typescript": "4.8.4"
  },
  "resolutions": {
    "@types/react": "18.0.28"
  },
  "jest": {
    "preset": "react-native",
    "setupFilesAfterEnv": [
      "@testing-library/jest-native/extend-expect"
    ],
    "setupFiles": [
      "./node_modules/react-native-gesture-handler/jestSetup.js",
      "./mock.js",
      "./clearTestDBFolder.js"
    ],
    "moduleFileExtensions": [
      "ts",
      "tsx",
      "js",
      "jsx",
      "json",
      "node"
    ],
    "transformIgnorePatterns": [
      "node_modules/(?!react-native-iap)/"
    ]
  }
}

firebase.json for react-native-firebase v6:

{
  "react-native": {
    "crashlytics_debug_enabled": true,
    "analytics_auto_collection_enabled": false,
    "crashlytics_auto_collection_enabled": false,
    "in_app_messaging_auto_collection_enabled": false
  },
  "functions": {
    "predeploy": "npm --prefix \"$RESOURCE_DIR\" run build",
    "source": "functions"
  },
  "firestore": {
    "rules": "firestore.rules",
    "indexes": "firestore.indexes.json"
  },
  "emulators": {
    "functions": {
      "port": 5001
    },
    "firestore": {
      "port": 8080
    },
    "pubsub": {
      "port": 8085
    },
    "ui": {
      "enabled": true
    }
  }
}

Environment

Click To Expand

react-native info output:

System:
    OS: macOS 13.2.1
    CPU: (8) arm64 Apple M1
    Memory: 78.20 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 17.9.1 - ~/.nvm/versions/node/v17.9.1/bin/node
    Yarn: 1.22.10 - ~/Projects/puzzleTimer/node_modules/.bin/yarn
    npm: 8.11.0 - ~/.nvm/versions/node/v17.9.1/bin/npm
    Watchman: 2023.04.03.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
    Android SDK: Not Found
  IDEs:
    Android Studio: Not Found
    Xcode: 14.2/14C18 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.18 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.2.0 => 18.2.0 
    react-native: 0.71.3 => 0.71.3 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found
  • Platform that you're experiencing the issue on:
    • [ x] iOS
    • [x ] Android
    • iOS but have not tested behavior on Android
    • Android but have not tested behavior on iOS
    • [x ] Both
  • react-native-firebase version you're using that has this issue:
    • 11.3.3
  • Firebase module(s) you're using that has the issue:
    • @react-native-firebase/auth
  • Are you using TypeScript?
    • Y & 4.8.4


Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: StaleIssue has become stale - automatically added by Stale bothelp: needs-triageIssue needs additional investigation/triaging.type: bugNew bug report

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions