Skip to content

Error when signing in with apple and google credentials. #3741

@isacjeppsson96

Description

@isacjeppsson96

Issue

(:fire:) Hi, I have an issue that's preventing me from using Apple and Google sign-in in my react native iOS app.
I'm using the '@invertase/react-native-apple-authentication'-package and I've followed the instructions to set up Apple sign-in on the Apple developer console and firebase console but it doesn't work.
When i call "await firebase.auth().signInWithCredential(appleCredential)" i get the error message: "The supplied auth credential is malformed or has expired.". This behaviour is the same when I use Google sign-in.

I have checked the credential that is being produced and it looks correct to me:

{token: "eyJraWQiOiI4NkQ4OEtmIiwiYWxnIjoiUlMyNTYifQ.eyJpc3M…-TF4ApZb2Nye-v6luV_u2lxTwAGsa*************", secret: "JG0Oh6KEldXYfwQoul_BUf_******", providerId: "apple.com"}

Any ideas what might be wrong?


Project Files

Javascript

const appleAuthRequestResponse = await appleAuth.performRequest({ requestedOperation: AppleAuthRequestOperation.LOGIN, requestedScopes: [AppleAuthRequestScope.EMAIL, AppleAuthRequestScope.FULL_NAME], });
// Ensure Apple returned a user identityToken if (!appleAuthRequestResponse.identityToken) { throw 'Apple Sign-In failed - no identify token returned'; }
const { identityToken, nonce } = appleAuthRequestResponse; const appleCredential = firebase.auth.AppleAuthProvider.credential(identityToken, nonce);

// Sign the user in with the credential await firebase.auth().signInWithCredential(appleCredential)

package.json:

# {
  "name": "BarZone",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "@bam.tech/react-native-make": "^3.0.0",
    "@invertase/react-native-apple-authentication": "^1.0.0",
    "@react-native-community/google-signin": "^4.0.1",
    "@react-native-community/masked-view": "^0.1.7",
    "@react-native-community/slider": "^2.0.9",
    "@react-navigation/native": "^5.1.1",
    "@react-navigation/stack": "^5.2.3",
    "date-fns": "^2.11.0",
    "geolib": "^3.2.1",
    "react": "16.9.0",
    "react-addons-update": "^15.6.2",
    "react-native": "0.61.5",
    "react-native-check-box": "^2.1.7",
    "react-native-device-info": "^5.5.6",
    "react-native-drawer": "^2.5.1",
    "react-native-fbsdk": "^1.1.2",
    "react-native-firebase": "^5.6.0",
    "react-native-flash-message": "^0.1.15",
    "react-native-gesture-handler": "^1.6.1",
    "react-native-get-location": "^1.4.2",
    "react-native-image-picker": "^2.3.1",
    "react-native-linear-gradient": "^2.5.6",
    "react-native-localization": "^2.1.6",
    "react-native-maps": "^0.27.1",
    "react-native-multiple-select": "^0.5.5",
    "react-native-responsive-screen": "^1.4.1",
    "react-native-safe-area-context": "^0.7.3",
    "react-native-screens": "^2.4.0",
    "react-native-shadow": "^1.2.2",
    "react-native-svg": "^12.1.0",
    "react-native-tags-chooser": "git+https://github.com/RZulfikri/react-native-tags-chooser.git",
    "react-native-vector-icons": "^6.6.0",
    "react-navigation": "^4.3.5"
  },
  "devDependencies": {
    "@babel/core": "^7.9.0",
    "@babel/runtime": "^7.9.2",
    "@react-native-community/eslint-config": "^0.0.7",
    "babel-jest": "^25.1.0",
    "eslint": "^6.8.0",
    "jest": "^25.1.0",
    "metro-react-native-babel-preset": "^0.59.0",
    "react-test-renderer": "16.9.0"
  },
  "jest": {
    "preset": "react-native"
  },
  "rnpm": {
    "assets": [
      "./assets/fonts"
    ]
  }
}

firebase.json for react-native-firebase v6:

# N/A

iOS

Click To Expand

ios/Podfile:

  • I'm not using Pods
  • I'm using Pods and my Podfile looks like:
# platform :ios, '9.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

target 'BarZone' do
  # Pods for BarZone
  pod 'Firebase/Analytics'
  pod 'Firebase/Auth'
  pod 'Firebase/Firestore'
  pod 'Firebase/Storage', '~> 6.13.0'
  pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
  pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
  pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
  pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
  pod 'React', :path => '../node_modules/react-native/'
  pod 'React-Core', :path => '../node_modules/react-native/'
  pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
  pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
  pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
  pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
  pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
  pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
  pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
  pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
  pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
  pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
  pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
  pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'

  pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
  pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
  pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
  pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
  pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon"
  pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
  pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'


  #pod 'RNFirebase', :path => '../node_modules/react-native-firebase'
pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'


  pod 'react-native-slider', :path => '../node_modules/@react-native-community/slider'

  pod 'ReactNativeGetLocation', :path => '../node_modules/react-native-get-location'

  pod 'react-native-safe-area-context', :path => '../node_modules/react-native-safe-area-context'

  pod 'RNAppleAuthentication', :path => '../node_modules/@invertase/react-native-apple-authentication'

  pod 'RNDeviceInfo', :path => '../node_modules/react-native-device-info'
pod 'GoogleSignIn', '~> 5.0.2'

  target 'BarZoneTests' do
    inherit! :search_paths
    # Pods for testing
  end

  use_native_modules!
end

target 'BarZone-tvOS' do
  # Pods for BarZone-tvOS

  target 'BarZone-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end

end

AppDelegate.m:

// N/A


Android

Click To Expand

Have you converted to AndroidX?

  • my application is an AndroidX application?
  • I am using android/gradle.settings jetifier=true for Android compatibility?
  • I am using the NPM package jetifier for react-native compatibility?

android/build.gradle:

// N/A

android/app/build.gradle:

// N/A

android/settings.gradle:

// N/A

MainApplication.java:

// N/A

AndroidManifest.xml:

<!-- N/A -->


Environment

react-native info output:

System:
    OS: macOS 10.15.4
    CPU: (4) x64 Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
    Memory: 202.55 MB / 8.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 13.5.0 - /usr/local/bin/node
    Yarn: 1.21.1 - /usr/local/bin/yarn
    npm: 6.13.4 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.5, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
  IDEs:
    Android Studio: 3.6 AI-192.7142.36.36.6241897
    Xcode: 11.5/11E608c - /usr/bin/xcodebuild
  npmPackages:
    react: 16.9.0 => 16.9.0 
    react-native: 0.61.5 => 0.61.5 
  npmGlobalPackages:
    react-native-cli: 2.0.1

EDIT:

I have now migrated to react-native-firebase v.6 but I still get the same error.

  • Platform that you're experiencing the issue on:
    • [x ] iOS
    • Android
    • iOS but have not tested behavior on Android
    • Android but have not tested behavior on iOS
    • Both
  • react-native-firebase version you're using that has this issue:
    • 5.6.0
  • Firebase module(s) you're using that has the issue:
    • ``
  • Are you using TypeScript?
    • N


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions