I implemented the nativescript-firebase (https://github.com/EddyVerbruggen/nativescript-plugin-firebase) plugin in my mobile app. It used to work fine but since I updated to the 11.1.3 version I cannot get the push token. I tried to get back to the 10.6.3 version but it says it is not available anymore when I execute npm install.
Here is what I do in my main.js
import { messaging } from "#nativescript/firebase/messaging";
import { firebase } from "#nativescript/firebase"
firebase.init({
onMessageReceivedCallback: function(message) {
//do stuff
}
}).then(function () {
messaging.getCurrentPushToken().then(token => {
console.log(token)
}).catch(e => {
console.log(e);
})
},function (error) {
console.log("firebase.init error: " + error);
});
This does not log the token but goes into the catch and logs this
Uncomment firebase-messaging in the plugin's include.gradle first
Here is my package.json
{
"name": "*****",
"main": "./src/main.js",
"version": "4.4.0",
"description": "A native application built with NativeScript-Vue",
"author": "*****",
"license": "PropriƩtaire",
"dependencies": {
"#carployee/openapp": "^1.0.1",
"#nativescript-community/ui-material-bottomnavigationbar": "^6.2.4",
"#nativescript/appavailability": "^2.0.0",
"#nativescript/appversion": "^2.0.0",
"#nativescript/camera": "^5.0.10",
"#nativescript/core": "~8.1.5",
"#nativescript/datetimepicker": "^2.1.9",
"#nativescript/firebase": "^11.1.3",
"#nativescript/imagepicker": "^1.0.6",
"#nativescript/ios": "^8.1.0",
"#nativescript/iqkeyboardmanager": "^2.0.0",
"#nativescript/theme": "^3.0.2",
"#nstudio/nativescript-cardview": "^2.0.1",
"#nstudio/nativescript-loading-indicator": "^4.1.0",
"#nstudio/nativescript-pulltorefresh": "^3.0.1",
"#proplugins/nativescript-purchase": "git+https://gitlab.******",
"#vue/devtools": "^5.3.4",
"nativescript-dna-deviceinfo": "^3.7.3",
"nativescript-feedback": "^2.0.0",
"nativescript-google-maps-sdk": "^3.0.2",
"nativescript-inappbrowser": "^3.1.2",
"nativescript-open-app": "^0.3.0",
"nativescript-phone": "^3.0.2",
"nativescript-socketio": "^3.3.1",
"nativescript-toasty": "^3.0.0-alpha.2",
"nativescript-ui-dataform": "^8.0.1",
"nativescript-ui-listview": "^10.0.2",
"nativescript-ui-sidedrawer": "^10.0.2",
"nativescript-vue": "^2.9.0",
"nativescript-vue-devtools": "^1.5.1",
"nativescript-vue-fonticon": "^1.0.3",
"nativescript-websockets": "^2.0.0",
"npm-check": "^5.9.2",
"npm-check-updates": "^12.0.2"
},
"devDependencies": {
"#babel/core": "^7.16.0",
"#babel/preset-env": "^7.16.4",
"#nativescript/android": "~8.1.1",
"#nativescript/webpack": "~5.0.1",
"babel-loader": "^8.2.3",
"nativescript-vue-template-compiler": "^2.9.0",
"nativescript-worker-loader": "~0.12.1",
"sass": "^1.44.0",
"vue-loader": "^15.9.8"
}
}
The message points you to the plugin's include.gradle file, or more specifically,
<app name>/node_modules/#nativescript/firebase/platforms/android/include.gradle
where you want to uncomment the line as shown below:
// Cloud Messaging (FCM)
implementation "com.google.firebase:firebase-messaging:20.1.0"
// implementation "me.leolin:ShortcutBadger:1.1.22#aar"
I expect if you reinstall the plugin you can answer the prompts so that this will get set for you.
Related
I have a page written in tsx that keeps crashing on load with the error client.watchQuery cannot be called with fetchPolicy set to "standby", even though the query in question is useLazyQuery (so it hasn't run yet), and has the option fetchPolicy: 'no-cache'. It crashes for me, but not for my teammates, which makes me think it might have something to do with package versions of maybe my local typescript, but I've set and re-set it every way I can think of with no improvement. The relevant code and package.json are below. Any insight at all would be wonderful.
// myfile.tsx
const [getRoles] = useLazyQuery(GET_ALL_ACCOUNT_ROLES, {
fetchPolicy: 'no-cache',
onError: (e) => {
console.error(e.message);
showPrompt({ type: 'error', message: 400 });
},
onCompleted: async (data) => {
const {
getAllAccountRoles: { data: res }
} = data;
setAllRoles(res);
}
});
package.json
"dependencies": {
"#apollo/react-hooks": "^4.0.0",
"#aws-amplify/api": "^4.0.13",
"#aws-amplify/auth": "^4.1.3",
"#emotion/react": "^11.4.1",
"#emotion/styled": "^11.3.0",
"#loadable/component": "^5.15.0",
"#mui/icons-material": "^5.1.0",
"#mui/material": "^5.1.0",
"#mui/system": "^5.1.0",
"#reach/router": "^1.3.4",
"#rinxun/custom-questions": "^1.1.2",
"#testing-library/jest-dom": "^5.11.4",
"#testing-library/react": "^11.1.0",
"#testing-library/user-event": "^12.1.10",
"apollo-boost": "^0.4.9",
"apollo-cache-inmemory": "^1.6.6",
"apollo-client": "^2.6.10",
"apollo-link": "^1.2.14",
"apollo-link-context": "^1.0.20",
"apollo-link-http": "^1.5.17",
"aws-appsync-auth-link": "^3.0.6",
"check-equal": "^1.0.7",
"clsx": "^1.1.1",
"dotenv": "^10.0.0",
"env-cmd": "^10.1.0",
"mockjs": "^1.1.0",
"qrcode.react": "^1.0.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-dropzone": "^11.3.4",
"react-scripts": "4.0.3",
"store": "^2.0.12",
"uuid": "^8.3.2"
},
"devDependencies": {
"#storybook/addon-actions": "^6.3.2",
"#storybook/addon-essentials": "^6.3.2",
"#storybook/addon-links": "^6.3.2",
"#storybook/node-logger": "^6.3.2",
"#storybook/preset-create-react-app": "^3.1.7",
"#storybook/react": "^6.3.2",
"#types/aws4": "^1.5.2",
"#types/jest": "^26.0.24",
"#types/loadable__component": "^5.13.4",
"#types/qrcode.react": "^1.0.2",
"#types/react": "^17.0.15",
"#types/react-dom": "^17.0.9",
"#types/uuid": "^8.3.1",
"#typescript-eslint/eslint-plugin": "^4.29.1",
"#typescript-eslint/parser": "^4.29.1",
"aws4": "^1.11.0",
"babel-eslint": "^10.1.0",
"babel-loader": "8.1.0",
"eslint": "^7.32.0",
"eslint-config-react-app": "^6.0.0",
"eslint-plugin-flowtype": "^5.9.0",
"eslint-plugin-import": "^2.24.0",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-react": "^7.24.0",
"eslint-plugin-react-hooks": "^4.2.0",
"graphql": "^15.5.1",
"lint-staged": "^11.1.1",
"prettier": "2.3.2",
"typescript": "^4.3.5",
"web-vitals": "^1.0.1"
},
I was having a similar problem. Traced it back to the issue useQuery doesn't seem to use defaultOptions in 3.5 in #apollo/client (a dependency of #apollo/react-hooks).
Solution for me was to downgrade by setting "#apollo/client": "~3.4.0" in the package.json and run npm install. Check your package-lock.json to ensure you've replaced your 3.5.x version.
#apollo/react-hooks has a dependency of #apollo-client.
If you have imported useQuery from #apollo/react-hooks, then you need to import useQuery/useLazyQuery from #apollo-client instead of #apollo/react-hooks, along with the version lower than 3.5.
I scoured the internet for this error on a build with an existing react app that was using nwb before finally stumbling upon this. In my case, the apollo client version was 3.0.2. Updating my package.json "#apollo/client": "~3.4.0" and re running npm i finally did the trick. Thank you #GratefulGuest!
I am trying to automate an Android application using appium and webdriverIO inside a typescript framework. I am using async mode.
My issue is when I am trying to use a waitUntil or any of the wait functions, they don't wait more than 3000ms, regardless of whatever custom timeout value I pass to the function. My best guess is, this is may be because of dependency issues.
Let me know if you guys need any additional information. I am attaching snippets of package.json and tsconfig to give you guys a brief overview of the packages I am using
package.json
"devDependencies": {
"#types/node": "^14.14.28",
"#types/uuid": "^8.3.0",
"#wdio/cli": "^7.2.3",
"dotenv": "^8.2.0",
"husky": "^5.1.3",
"nodemon": "^2.0.7",
"ts-node": "^9.1.1",
"ts-node-dev": "^1.1.1",
"tslint": "^6.1.3",
"typescript": "^4.1.5"
},
"dependencies": {
"#wdio/local-runner": "^7.1.2",
"#wdio/mocha-framework": "^7.1.2",
"#wdio/spec-reporter": "^7.1.1",
"#wdio/sync": "^7.1.1",
"appium-chromedriver": "^4.27.0",
"assert": "^2.0.0",
"axios": "^0.21.1",
"chromedriver": "^89.0.0",
"tslog": "^3.1.1",
"uuid": "^8.3.2",
"wdio-chromedriver-service": "^7.0.0",
"webdriverio": "^5.10.4"
}
tscnofig.json
"types": [
"node", "webdriverio/async", "#wdio/mocha-framework"
],
My wait until Function is as follows :
async waitUntil(params: any) {
const waitOnElement = await this.client.$(element);
await waitOnElement.waitUntil( async () => {
return await waitOnElement.getText() === text
}, {
"timeout": timeout
})
}
I maintain an browser-based Angular app that was at version 5.6. This app has two components that subscribe to an IOT topic and listen for updates (no pub, just sub).
We need to upgrade to Agnular 11.0.3. I have completed that work. But now the aws-iot-device-sdk NPM module caucuses these errors when I try to run the local web server or run a build:
Error: Can't resolve 'fs' in '[PATH_TO]/node_modules/aws-iot-device-sdk/common/lib'
Error: Can't resolve 'path' in '[PATH_TO]/node_modules/aws-iot-device-sdk/device'
Error: Can't resolve 'fs' in '[PATH_TO]/node_modules/aws-iot-device-sdk/device'
Error: Can't resolve 'tls' in '[PATH_TO]/node_modules/aws-iot-device-sdk/device/lib'
I have spent many hours pulling my hair out on this issue. Our front-end (browser) IOT code has been working perfectly for the last few years. But the upgrade to Angular 11.0.3 has to happen and this issue is a big blocker.
SAMPLE CODE FROM OUR APPLICATION:
(Our package.json is at the end)
The xxxx-app.component.ts file:
import { AwsIotService } from '../../shared/awsIot/awsIot.service';
this.awsIotService.getNewIotConnection(this.iotTopic, this.iotUrl, (iotClient) => {
//cache the iotClient
this.iotClient = iotClient;
//handle the iotClient's message event
iotClient.on('message', (topic, message) => {
// process the message here:
console.log('IOT Message received:');
console.dir(message);
});
});
awsIotService.ts:
In the code below, "iotUrl" points to a custom service we wrote that provides the details needed by the browser-based Angular app in order to connect and subscribe:
awsIot = require('aws-iot-device-sdk'); //simply requiring that NPM module causes the errors stated above
getNewIotConnection (topic, iotUrl, callback) {
this.httpClient.get(iotUrl).subscribe(responseData => {
const client = this.awsIot.device({
port: 443,
protocol: 'wss',
region: responseData.region,
host: responseData.iotEndpoint,
secretKey: responseData.secretKey,
accessKeyId: responseData.accessKey,
sessionToken: responseData.sessionToken,
});
// subscribe to the topic
client.on('connect', () => client.subscribe(topic));
// call the callback
callback(client);
});
}
UP-TO-DATE SUGGESTIONS THAT I HAVE TRIED:
1 - I have tried using https://www.npmjs.com/package/aws-iot-device-sdk-v2
....but have not found the documentation helpful... I hope I am missing something here.
2 I have tried AWS amplify and followed this tutorial:
https://docs.amplify.aws/start/getting-started/installation/q/integration/angular
...but using AWS amplify to solve this issue would require a re-work of the back-end we built and seems like getting a new transmission for a flat tire (i.e. just need to subscribe to an IOT topic).
OLDER WORKAROUNDS THAT I HAVE TRIED:
3 I tried adding this to package.json:
"browser": {
"fs": false,
"path": false,
"os": false
}
...that did not work.
4 I tried adding this to package.json:
"dependencies": {
...other packages
"mqtt": "2.15.1",
"minimist": "1.2.0",
"websocket-stream": "^5.0.1",
"crypto-js": "3.1.6"
}
...that did not work.
5 I tried the patch.js approach detailed here:
https://gist.github.com/niespodd/1fa82da6f8c901d1c33d2fcbb762947d
...that did not work.
6 I tried adding this to webpack.config.js :
resolve: {
fallback: {
fs: false
}
}
...that did not work.
7 I tried adding this to webpack.config.js :
node: {
fs: 'empty'
}
...that did not work (only works in older WebPack.)
Our package.json (just dependencies & devDependencies):
"dependencies": {
"#angular/animations": "^11.0.3",
"#angular/cdk": "^11.0.1",
"#angular/common": "^11.0.3",
"#angular/core": "^11.0.3",
"#angular/forms": "^11.0.3",
"#angular/platform-browser": "^11.0.3",
"#angular/platform-browser-dynamic": "^11.0.3",
"#angular/router": "^11.0.3",
"#mapbox/mapbox-gl-draw": "^1.2.0",
"#mapbox/mapbox-gl-geocoder": "^2.2.0",
"#ng-bootstrap/ng-bootstrap": "^8.0.0",
"#turf/helpers": "^6.0.0",
"#turf/inside": "^5.0.0",
"#turf/turf": "^5.1.6",
"#types/lodash": "^4.14.165",
"#types/unist": "^2.0.0",
"angular-calendar": "^0.28.22",
"aws-iot-device-sdk": "^2.2.6",
"core-js": "^3.6.4",
"date-fns": "^2.16.1",
"intl": "^1.2.4",
"jquery": "^3.1.1",
"lodash": "^4.17.20",
"mapbox-gl": "^2.0.0",
"moment": "^2.12.0",
"moment-timezone": "^0.5.27",
"ng2-datepicker": "^3.1.1",
"rxjs": "^6.5.4",
"rxjs-compat": "^6.6.3",
"selenium-webdriver": "^3.6.0",
"tslib": "^2.0.0",
"zone.js": "^0.11.3"
},
"devDependencies": {
"#angular-devkit/build-angular": "~0.1100.3",
"#angular/cli": "^11.0.3",
"#angular/compiler": "^11.0.3",
"#angular/compiler-cli": "^11.0.3",
"#ngtools/webpack": "^11.0.3",
"#types/jasmine": "^3.6.2",
"#types/jquery": "^2.0.34",
"#types/node": "^14.14.10",
"#webpack-cli/serve": "^1.1.0",
"angular-router-loader": "^0.8.5",
"angular2-template-loader": "^0.6.2",
"codelyzer": "^6.0.0",
"copy-webpack-plugin": "^6.3.2",
"cross-env": "^7.0.3",
"css-loader": "^5.0.1",
"exports-loader": "^1.1.1",
"html-loader": "^1.3.2",
"html-webpack-plugin": "^4.5.0",
"jasmine-core": "^3.6.0",
"jasmine-spec-reporter": "^5.0.0",
"karma": "^5.2.3",
"karma-chrome-launcher": "^3.1.0",
"karma-coverage": "^2.0.3",
"karma-coverage-istanbul-reporter": "^3.0.3",
"karma-jasmine": "^4.0.1",
"karma-jasmine-html-reporter": "^1.5.4",
"karma-mocha-reporter": "^2.2.5",
"mini-css-extract-plugin": "^1.0.0",
"postcss": "^8.1.13",
"postcss-import": "^13.0.0",
"postcss-loader": "^4.1.0",
"postcss-nested": "^5.0.2",
"protractor": "^7.0.0",
"raw-loader": "^1.0.0",
"rimraf": "^3.0.2",
"retyped-stripe-tsd-ambient": "^0.0.0-0",
"sass": "^1.29.0",
"sass-loader": "^10.1.0",
"script-ext-html-webpack-plugin": "^2.1.5",
"style-loader": "^2.0.0",
"to-string-loader": "^1.1.6",
"ts-loader": "^8.0.11",
"ts-node": "^8.3.0",
"tslint": "^6.1.0",
"typescript": "4.0.3",
"webpack": "^5.9.0",
"webpack-cli": "^4.2.0",
"webpack-dev-server": "^3.11.0"
},
Does this help? The author seemed to have/avoid the same trouble as you. He mentions:
"browser": {
"fs": false,
"tls": false,
"path": false
},
I'm using the following environment:
Angular CLI: 12.2.13
Node: 16.13.0 (Unsupported)
Package Manager: npm 8.1.0
OS: linux x64
Package Version
---------------------------------------------------------
#angular-devkit/architect 0.1202.13
#angular-devkit/build-angular 12.2.13
#angular-devkit/core 12.2.13
#angular-devkit/schematics 12.2.13
#angular/cdk 12.2.12
#schematics/angular 12.2.13
ng-packagr 12.2.5
rxjs 6.6.7
typescript 4.3.5
And in order to complement the approach of #kackle123, the following worked for me in package.json:
"browser": {
"http": false,
"https": false,
"net": false,
"path": false,
"stream": false,
"tls": false,
"fs": false
}
But it only mute the error outputs, and the package will not work anyways.
I'm trying to send unhandled exceptions in JavaScript code to Crashlytics. I have added below code to catch any unhandle JavaScript exceptions. However, this code (console.log or Crashlytics event) does not get executed for any error thrown inside a React Component. For example, if I add a throw new ReferenceError() inside the render method of my main component, I see the red error box but nothing happens in terms of my custom error handling.
import { Platform } from 'react-native';
import StackTrace from 'stacktrace-js';
import { Crashlytics } from 'react-native-fabric';
const originalHandler = global.ErrorUtils.getGlobalHandler();
function errorHandler(e, isFatal) {
StackTrace.fromError(e, { offline: true }).then((x) => {
Crashlytics.recordCustomExceptionName(e.message, e.message, x.map(row => (Object.assign({}, row, {
fileName: `${row.fileName}:${row.lineNumber || 0}:${row.columnNumber || 0}`,
}))));
});
console.log('Error caught', e);
// And then re-throw the exception with the original handler
if (originalHandler) {
if (Platform.OS === 'ios') {
originalHandler(e, isFatal);
} else {
// On Android, throwing the original exception immediately results in the
// recordCustomExceptionName() not finishing before the app crashes and therefore not logged
// Add a delay to give it time to log the custom JS exception before crashing the app.
// The user facing effect of this delay is that separate JS errors will appear as separate
// issues in the Crashlytics dashboard.
setTimeout(() => {
originalHandler(e, isFatal);
}, 3000);
}
}
}
global.ErrorUtils.setGlobalHandler(errorHandler);
Also, I noticed that if I bundle the same app as a signed release APK, the app does not crash. Instead, it shows a blank screen. I tried without my custom error handler, still it won't crash. A freshly created React Native app APK crashes in release mode if I throw the exact same error inside a component. Which leads me to think the problem might be with any library I have added. I have included my package.json here. At the moment, the only way I see is to start from a blank project and add each library one-by-one till I see the issue, but it would be a waste of time if the issue was somewhere else. Therefore, appreciate if anyone can give a hint or suggestion for me to pinpoint the root cause.
{
"name": "MyReactNativeApp",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest --coverage",
"postinstall": "react-native-schemes-manager all"
},
"xcodeSchemes": {
"Debug": [
"Debug"
],
"Release": [
"Staging"
]
},
"dependencies": {
"axios": "^0.18.0",
"i18next": "^11.3.1",
"lodash": "^4.17.10",
"moment": "^2.22.1",
"react": "16.3.1",
"react-i18next": "^7.6.1",
"react-native": "0.55.3",
"react-native-config": "^0.11.5",
"react-native-elements": "^0.19.1",
"react-native-fabric": "^0.5.1",
"react-native-sensitive-info": "^5.1.0",
"react-native-vector-icons": "^4.6.0",
"react-navigation": "^2.0.1",
"react-navigation-redux-helpers": "^1.0.6",
"react-redux": "^5.0.7",
"redux": "^4.0.0",
"redux-persist": "^5.9.1",
"redux-persist-sensitive-storage": "^1.0.0",
"redux-saga": "^0.16.0",
"reselect": "^3.0.1",
"stacktrace-js": "^2.0.0"
},
"devDependencies": {
"babel-eslint": "^8.2.3",
"babel-jest": "22.4.3",
"babel-preset-react-native": "4.0.0",
"enzyme": "^3.3.0",
"enzyme-adapter-react-16": "^1.1.1",
"enzyme-to-json": "^3.3.3",
"eslint": "^4.19.1",
"eslint-config-airbnb": "^16.1.0",
"eslint-plugin-flowtype": "^2.46.3",
"eslint-plugin-import": "^2.11.0",
"eslint-plugin-jsx-a11y": "^6.0.3",
"eslint-plugin-react": "^7.7.0",
"eslint-plugin-react-native": "^3.2.1",
"flow-bin": "^0.71.0",
"jest": "22.4.3",
"react-dom": "^16.3.2",
"react-native-schemes-manager": "^1.0.4",
"react-test-renderer": "16.3.1",
"reactotron-react-native": "^1.14.0",
"reactotron-redux": "^1.13.0",
"reactotron-redux-saga": "^1.13.0",
"redux-devtools-extension": "^2.13.2",
"redux-mock-store": "^1.5.1"
},
"jest": {
"preset": "react-native",
"snapshotSerializers": [
"enzyme-to-json/serializer"
],
"setupFiles": [
"<rootDir>/jest/setup.js"
],
"moduleNameMapper": {
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/jest/assetsTransformer.js",
"\\.(css|less)$": "<rootDir>/jest/assetsTransformer.js"
}
}
}
I'm trying to use Firebase with Electron. When installing it just like I would on a web page it doesn't work because Electron pages are hosted locally and don't have a hostname. This is the error I'm getting...
Uncaught Error: This domain is not authorized for OAuth operations for your Firebase project. Edit the list of authorized domains from the Firebase console.
I can't add an empty (or wildcard) authorized domain to the Firebase console so I'm therefore stuck. Does anybody have any ideas of how to work around this?
edit: Here's the code I'm using, it's just the standard boilerplate, nothing extra...
<script src="https://www.gstatic.com/firebasejs/live/3.0/firebase.js"></script>
<script>
var config = {
apiKey: "AIzaSyBvmmPB0_Oddc-02cUj3Ntt3wi8jSxxxx",
authDomain: "xxxxx-d24ad.firebaseapp.com",
databaseURL: "https://xxxxx-d24ad.firebaseio.com",
storageBucket: "",
};
firebase.initializeApp(config);
</script>
I don't know if this is the best solution but is a workaround.
create a file server.js with a simple express server
"server.js"
var express = require('express');
var http = require('http');
var path = require('path');
var appServer = express();
appServer.use(express.static(path.join(__dirname, '')));
appServer.get('*', (req, res) => {
res.sendFile(__dirname + 'index.html');
});
http.createServer(appServer).listen(3007, function() {
console.log('Express server listening on port');
});
In your main.js(electron-main-js-file)
On the top of the main.js start the node server
require('./server');
and change the "win.loadURL"
win.loadURL('http://localhost:3007');
I've fork your project and implement, the error from firebase is gone but jQuery is not defined, I think you can fix that.
https://github.com/diegoddox/sad-electron-firebase-error
For now, you can suppress this error by removing the authDomain line from your config. authDomain is needed for the Auth signInWithPopup/signInWithRedirect operations, but everything else should work.
A version of the library that throws that error only when you actually try to do a signInWithPopup/Redirect is in the works.
You can use firebase auth's GitHub, Twitter, Facebook, Google Provider with electron by using the manual sign in flow and firebase auth signInWithCredential method.
https://firebase.google.com/docs/auth/web/github-auth#handle_the_sign-in_flow_manually
I created useful library for these case.
https://github.com/mironal/electron-oauth-helper#firebase-auth-integration
// Github manually flow example.
const { OAuth2Provider } = require("electron-oauth-helper")
const config = { /* oauth config. please see example/main/config.example.js. */}
const provider = new OAuth2Provider(config)
provider.perform()
.then(resp => {
const query = querystring.parse(resp)
const credential = firebase.auth.GithubAuthProvider.credential(query.access_token)
firebase.auth().signInWithCredential(credential)
.then(user => {
console.log(user)
})
.catch(error => console.error(error))
})
.catch(error => console.error(error))
It's works in Electron 6.0.1 (Google, Facebook and Twitter Auth) through .signInWithPopup. Environment:
node 10.16.2 LTS
electron 6.0.1
vs2017-win2016
electron-forge 5.2.4
electron's package.json
"dependencies": {
"#capacitor/electron": "^1.1.0",
"electron-compile": "^6.4.4",
"electron-squirrel-startup": "^1.0.0"
},
"devDependencies": {
"babel-plugin-transform-async-to-generator": "^6.24.1",
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"electron-forge": "^5.2.4",
"electron-prebuilt-compile": "4.0.0"
},
Angular's package
"dependencies": {
"#angular/animations": "^8.2.0-next.1",
"#angular/cdk": "^8.0.0",
"#angular/common": "^8.2.0-next.1",
"#angular/core": "^8.2.0-next.1",
"#angular/fire": "^5.2.1",
"#angular/forms": "^8.2.0-next.1",
"#angular/material": "^8.0.0",
"#angular/platform-browser": "^8.2.0-next.1",
"#angular/platform-browser-dynamic": "^8.2.0-next.1",
"#angular/pwa": "^0.800.2",
"#angular/router": "^8.2.0-next.1",
"#angular/service-worker": "^8.2.0-next.1",
"#capacitor/core": "1.1.0",
"#ionic/angular": "^4.6.2",
"#ngx-loading-bar/core": "^4.2.0",
"#ngx-loading-bar/router": "^4.2.0",
"#ngxs/logger-plugin": "^3.3.2",
"#ngxs/store": "^3.3.2",
"angulartics2": "^7.5.2",
"echarts": "^4.2.1",
"firebase": "^6.1.1",
"hammerjs": "^2.0.8",
"immutable": "^4.0.0-rc.12",
"ngx-echarts": "^4.1.1",
"ngx-permissions": "^7.0.3",
"ngx-stars": "^1.3.0",
"rxjs": "6.5.2",
"zone.js": "~0.9.1"
},
"devDependencies": {
"#angular-devkit/build-angular": "~0.802.0-next.0",
"#angular/cli": "~8.2.0-next.0",
"#angular/compiler": "^8.2.0-next.1",
"#angular/compiler-cli": "~8.2.0-next.1",
"#angular/language-service": "~8.2.0-next.1",
"#capacitor/cli": "^1.0.0",
"#compodoc/compodoc": "^1.1.10",
"#ionic/angular-toolkit": "~2.0.0",
"#ngxs/devtools-plugin": "^3.4.3",
"#ngxs/schematics": "0.0.1-alpha.5",
"#types/echarts": "^4.1.9",
"#types/jasmine": "^3.3.12",
"#types/jasminewd2": "~2.0.6",
"#types/node": "~11.13.4",
"ajv": "^6.9.1",
"codelyzer": "~5.0.0",
"html-minifier": "^4.0.0",
"ionic": "^5.0.1",
"jasmine-core": "~3.4.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "^4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.5",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"karma-mocha-reporter": "^2.2.5",
"protractor": "~5.4.0",
"sonarqube-scanner": "^2.4.0",
"ts-node": "~8.0.3",
"tslint": "~5.15.0",
"tslint-sonarts": "^1.9.0",
"typescript": "~3.4.3"
},
I've compiled for Windows with:
DEBUG='electron-forge:*' node_modules/.bin/electron-forge make