This file contains hidden or 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
| <template> | |
| <q-page class="row items-center justify-evenly"> | |
| <q-btn color="primary" @click="signIn">Sign in</q-btn> | |
| <q-input v-model="status" label="Status" /> | |
| <q-btn color="primary" @click="saveStatus(loggedInUserName, status, avatarUrl)">Save status</q-btn> | |
| <q-card v-for="(val, index) in statuses" :key="index"> | |
| <q-card-section> | |
| <q-item-section avatar v-if="val.avatarUrl"> |
This file contains hidden or 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
| @override | |
| void initState() { | |
| deepLinkSubscription = getLinksStream().listen((String link) { | |
| loginWithGitHub(link); | |
| }, cancelOnError: true); | |
| super.initState(); | |
| } | |
| //... |
This file contains hidden or 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
| String host = String(FUNCTIONS_REGION) + "-" + String(PROJECT_ID) + ".cloudfunctions.net"; | |
| HttpClient httpClient = HttpClient(wifiClient, host, 443); | |
| httpClient.post("/getIdToken", "text/plain", deviceToken); |
This file contains hidden or 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
| ECCX08.begin(); | |
| String deviceToken = ECCX08JWS.sign(/* slot */ 0, header, payload); |
This file contains hidden or 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
| res.send({ | |
| nonce: await getNextNonce(device), | |
| idToken, | |
| }); |
This file contains hidden or 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
| const customToken = await admin | |
| .auth() | |
| .createCustomToken(device.data.uid, { deviceId: device.id }); | |
| const idTokenResponse = await axios.post<SignInWithCustomTokenResponse>( | |
| "https://identitytoolkit.googleapis.com/v1/accounts:signInWithCustomToken?key=" + | |
| WEBAPP_APIKEY, | |
| { token: customToken, returnSecureToken: true } | |
| ); | |
| const idToken = idTokenResponse.data.idToken; |
This file contains hidden or 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
| if (!device.data.uid) { | |
| res.send({ | |
| message: "Unclaimed device!", | |
| }); | |
| } |
This file contains hidden or 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
| const payloadNonce = Number(JSON.parse(payload).nonce); | |
| const nonce = device.data.nonce; | |
| if (payloadNonce !== nonce) { | |
| res.send({ | |
| message: "Invalid nonce!", | |
| }); | |
| } |
This file contains hidden or 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
| const alg = "ES256"; | |
| const verifyResult = verify( | |
| deviceToken, | |
| alg, | |
| device.data.publicKey | |
| ); | |
| if (!verifyResult || header.alg !== alg) { | |
| res.send({ | |
| message: "Invalid JWT!", | |
| }); |
This file contains hidden or 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
| const deviceToken = req.body; | |
| const { header, payload } = decode(deviceToken); | |
| const device = header.kid && (await getDevice(header.kid)); | |
| if (!device) { | |
| res.send({ | |
| message: "Unknown device!", | |
| }); | |
| } |
NewerOlder