-
-
Save patrickkettner/50291d324bd5decffe92ab34cfd85606 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { GoogleAuthProvider, initializeAuth } from "firebase/auth"; | |
chrome.identity.getAuthToken({ 'interactive': true }, async (token) => { | |
const credential = GoogleAuthProvider.credential(null, token); | |
try { | |
const app = initializeApp({/** Your app config */}); | |
const auth = initializeAuth(app, {popupRedirectResolver: undefined}); | |
const {user} = await auth.signInWithCredential(credential) | |
console.log(`the user object is here! - ${user}`) | |
} catch (e) { | |
console.error(error); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "firebase-auth-remote-code-demo", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"type": "module", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1", | |
"build": "rollup -c rollup.config.js" | |
}, | |
"keywords": [], | |
"author": "", | |
"license": "ISC", | |
"dependencies": { | |
"firebase": "9.18.0" | |
}, | |
"devDependencies": { | |
"@rollup/plugin-node-resolve": "^15.2.1", | |
"rollup": "^3.29.3" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { nodeResolve } from '@rollup/plugin-node-resolve'; | |
export default { | |
input: './index.mjs', | |
output: { | |
file: './bundle.js', | |
format: 'iife' | |
}, | |
plugins: [nodeResolve()] | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment