In our application we use firebase messaging to communicate with the logged in user, therefore we call getToken()
after the user logs in or in App.js after opening the application if the user is already logged in. If the user logs out of the application, we call deleteToken()
.
On Android, every time we call getToken()
after deleteToken()
, a new token is generated, which we save on our backend and use it to send messages. However, on IOS, in the same scenario, a new token is not generated, but the old token is returned, so when we try to send a message from our backend, we get the error "Request entity not found". Is this an intended action? Should I generate a token for different users in different scope?
Click To Expand
#### `package.json`:
{
"name": "app",
"version": "0.1.0",
"description": "App",
"scripts": {
"start": "react-native start",
"tsc": "tsc -p ./tsconfig.json",
"tsc:dev": "tsc -w -p ./tsconfig.json",
"android": "react-native run-android --no-jetifier",
"ios": "react-native run-ios",
"lint": "npm run tsc && npm run eslint && npm run stylelint",
"stylelint": "stylelint \"components/**/*.tsx\"",
"eslint": "eslint . --ext .ts --ext .tsx --ext .js --fix",
"prettier": "prettier ./**/*.tsx ./**/*.ts ./**/*.js --list-different || (echo '\nPlease run the following command to fix:\nnpm run prettier:fix\n'; exit 1)",
"prettier:fix": "prettier ./**/*.tsx ./**/*.tsx ./**/*.ts ./**/*.js --write",
"pre-commit": "lint-staged",
"test": "jest",
"test:dev": "jest --watch",
"test:coverage": "jest --coverage",
"postinstall": "patch-package && jetify"
},
"lint-staged": {
"*.{tsx,ts,js}": [
"npm run lint",
"git add"
]
},
"husky": {
"hooks": {
"pre-commit": "npm run pre-commit"
}
},
"dependencies": {
"@dooboo-ui/native-switch-toggle": "0.4.0",
"@ptomasroos/react-native-multi-slider": "2.2.2",
"@react-native-community/async-storage": "1.7.1",
"@react-native-community/cameraroll": "2.0.0",
"@react-native-community/google-signin": "4.0.3",
"@react-native-community/image-editor": "2.3.0",
"@react-native-firebase/app": "8.0.0",
"@react-native-firebase/messaging": "7.2.1",
"@types/lodash": "4.14.149",
"@types/ptomasroos__react-native-multi-slider": "0.0.1",
"@types/react-native-calendars": "1.20.8",
"@types/react-native-fbsdk": "1.1.0",
"@types/react-native-push-notification": "5.0.2",
"@types/react-native-share": "3.3.0",
"@types/react-redux": "7.1.5",
"@types/sockjs-client": "1.1.1",
"@types/stompjs": "2.3.4",
"@types/styled-components": "4.1.19",
"@types/uuid": "3.4.6",
"@types/yup": "0.26.30",
"axios": "0.19.0",
"camelcase-keys": "6.1.1",
"esm": "3.2.25",
"formik": "2.1.4",
"geolib": "3.3.1",
"i18next": "19.0.2",
"libphonenumber-js": "1.7.53",
"lodash": "4.17.15",
"moment": "2.24.0",
"net": "1.0.2",
"numbro": "2.3.1",
"polygon-clipping": "0.15.1",
"rbush": "1.4.3",
"react": "16.9.0",
"react-dom": "16.8.6",
"react-i18next": "11.2.7",
"react-native": "0.61.5",
"react-native-branch": "5.0.0-beta.1",
"react-native-calendars": "1.300.0",
"react-native-camera": "3.23.1",
"react-native-config": "0.12.0",
"react-native-confirmation-code-field": "4.1.0",
"react-native-device-info": "5.6.1",
"react-native-draggable-flatlist": "2.4.0",
"react-native-fbsdk": "2.0.0",
"react-native-fs": "2.16.6",
"react-native-geocoding": "0.4.0",
"react-native-geolocation-service": "4.0.0",
"react-native-gesture-handler": "1.6.1",
"react-native-gifted-chat": "0.16.0",
"react-native-highlight-words": "1.0.1",
"react-native-image-crop-picker": "0.28.0",
"react-native-image-resizer": "1.2.1",
"react-native-image-size": "1.1.3",
"react-native-linear-gradient": "2.5.6",
"react-native-map-clustering": "3.1.2",
"react-native-maps": "0.27.1",
"react-native-masked-text": "1.13.0",
"react-native-modal": "11.4.0",
"react-native-permissions": "2.1.5",
"react-native-picker-select": "6.3.3",
"react-native-push-notification": "5.1.0",
"react-native-reanimated": "1.9.0",
"react-native-redash": "12.6.0",
"react-native-safe-area-context": "3.1.7",
"react-native-screens": "1.0.0-alpha.22",
"react-native-share": "4.0.1",
"react-native-splash-screen": "3.2.0",
"react-native-status-bar-height": "2.5.0",
"react-native-svg": "9.9.9",
"react-native-swipe-gestures": "1.0.5",
"react-native-swipe-list-view": "2.1.3",
"react-native-text-size": "4.0.0-rc.1",
"react-native-web": "0.11.4",
"react-navigation": "4.0.6",
"react-navigation-stack": "1.8.0",
"react-navigation-transitions": "1.0.12",
"react-redux": "7.1.3",
"recyclerlistview": "3.0.0",
"reduce-reducers": "1.0.4",
"redux": "4.0.4",
"redux-devtools-extension": "2.13.8",
"redux-persist": "6.0.0",
"redux-thunk": "2.3.0",
"rn-fetch-blob": "0.12.0",
"rn-sliding-up-panel": "2.4.2",
"sockjs-client": "1.4.0",
"stompjs": "2.3.3",
"styled-components": "4.4.0",
"uuid": "3.3.3",
"yup": "0.28.1"
},
"devDependencies": {
"@babel/core": "7.6.2",
"@babel/runtime": "7.6.2",
"@react-native-community/eslint-config": "1.1.0",
"@testing-library/jest-native": "3.0.2",
"@testing-library/react-native": "4.0.14",
"@types/jest": "24.0.18",
"@types/react": "16.8.23",
"@types/react-native": "0.57.65",
"@types/react-test-renderer": "16.8.3",
"@types/redux-mock-store": "1.0.2",
"@typescript-eslint/eslint-plugin": "2.34.0",
"@typescript-eslint/parser": "2.34.0",
"babel-jest": "24.9.0",
"eslint": "6.5.1",
"eslint-config-prettier": "6.11.0",
"eslint-config-react-app": "5.2.1",
"eslint-plugin-flowtype": "5.1.3",
"eslint-plugin-import": "2.20.2",
"eslint-plugin-jsx-a11y": "6.2.3",
"eslint-plugin-react": "7.20.0",
"eslint-plugin-react-hooks": "4.0.8",
"husky": "3.0.5",
"jest": "24.9.0",
"jest-date-mock": "1.0.8",
"jest-svg-transformer": "1.0.0",
"lint-staged": "9.3.0",
"metro-react-native-babel-preset": "0.56.0",
"patch-package": "6.2.2",
"prettier": "2.0.5",
"react-native-svg-transformer": "0.13.0",
"react-test-renderer": "16.9.0",
"redux-mock-store": "1.5.4",
"stylelint": "11.1.1",
"stylelint-config-prettier": "8.0.2",
"stylelint-config-standard": "19.0.0",
"stylelint-config-styled-components": "0.1.1",
"stylelint-processor-styled-components": "1.8.0",
"ts-jest": "24.1.0",
"typescript": "3.8.3"
},
"private": true
}
#### `firebase.json` for react-native-firebase v6:
# N/A
### iOS
#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like:
# N/A
#### `AppDelegate.m`:
// N/A
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 -->
Click To Expand
**`react-native info` output:**
System:
OS: Linux 5.4 elementary OS 5.1.7 Hera
CPU: (8) x64 Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
Memory: 297.82 MB / 15.41 GB
Shell: 4.4.20 - /bin/bash
Binaries:
Node: 12.16.1 - ~/.nvm/versions/node/v12.16.1/bin/node
npm: 6.13.4 - ~/.nvm/versions/node/v12.16.1/bin/npm
IDEs:
Android Studio: 3.6 AI-192.7142.36.36.6392135
npmPackages:
react: 16.9.0 => 16.9.0
react-native: 0.61.5 => 0.61.5
- **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:**
- `e.g. 7.2.1`
- **`Firebase` module(s) you're using that has the issue:**
- `messaging`
- **Are you using `TypeScript`?**
- `Y` & `3.8.3`
React Native Firebase
and Invertase
on Twitter for updates on the library.Hi there! This is not intended or expected, but can you reproduce it still with v10 of react-native-firebase?
"@react-native-firebase/app": "8.0.0",
"@react-native-firebase/messaging": "7.2.1",
@mikehardy yep still the same after upgrading to v10
Well that's unfortunate - thanks for checking, this will likely be an upstream issue - the surest course to resolution will be to do a quickstart reproduction based on: https://github.com/firebase/quickstart-ios/tree/master/messaging (or perhaps even https://github.com/firebase/quickstart-ios/tree/master/installations as I think it is the underlying provider of tokens?) with exact steps / iOS versions etc to reproduce
Any workaround so far? Unfortunately, we got stuck with this problem as well.
All information will be present on this issue assuming it is referenced if there is an issue logged upstream - what you see is what we know (not a lot unfortunately) - it needs someone from the community to dig in for triage
Same problem.
This works for me: https://github.com/invertase/react-native-firebase/issues/3714#issuecomment-721027986 and https://github.com/invertase/react-native-firebase/issues/3714#issuecomment-699838886
deleteToken(undefined, '*')
getToken(undefined, '*')
getToken
never resolve a promise if call it without arguments after deleteToken(undefined, '*')
@Chachaproper thank you so much for cross-linking that, I had forgotten that. @michaelyav / @mkuligowski this may be thing you need, and we likely need to integrate it into our code as the default (I don't believe there is a PR pending for this, if not and it is confirmed as working we would welcome one and I'd help get it merged + released)
@Chachaproper thank you man ! i spended a lot of time to find out what the f*ck is happening there >_<
Hello 馃憢, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time. Has this issue been fixed, or does it still require the community's attention?
This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.
Most helpful comment
Same problem.
This works for me: https://github.com/invertase/react-native-firebase/issues/3714#issuecomment-721027986 and https://github.com/invertase/react-native-firebase/issues/3714#issuecomment-699838886
getToken
never resolve a promise if call it without arguments afterdeleteToken(undefined, '*')