This commit is contained in:
+10
-6
@@ -3,7 +3,7 @@ import * as AuthSession from "expo-auth-session";
|
||||
import * as GoogleAuth from "expo-auth-session/providers/google";
|
||||
import * as WebBrowser from "expo-web-browser";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { Platform, Pressable, Text, View } from "react-native";
|
||||
import { Pressable, Text, View } from "react-native";
|
||||
import { useGlobal } from "reactn";
|
||||
import { background } from "../assets";
|
||||
import GradientButton from "../components/GradientButton.js";
|
||||
@@ -106,13 +106,15 @@ export default ({ navigation }) => {
|
||||
|
||||
if (!idToken) {
|
||||
// Otherwise, exchange the authorization code for tokens using PKCE.
|
||||
const code = response?.params?.code || response?.authentication?.code;
|
||||
const code =
|
||||
response?.params?.code || response?.authentication?.code;
|
||||
if (!code) throw new Error("Code d'autorisation Google manquant");
|
||||
|
||||
// Use the exact clientId used during the authorize request.
|
||||
const clientId = request?.clientId;
|
||||
const discovery = {
|
||||
authorizationEndpoint: "https://accounts.google.com/o/oauth2/v2/auth",
|
||||
authorizationEndpoint:
|
||||
"https://accounts.google.com/o/oauth2/v2/auth",
|
||||
tokenEndpoint: "https://oauth2.googleapis.com/token",
|
||||
revocationEndpoint: "https://oauth2.googleapis.com/revoke",
|
||||
};
|
||||
@@ -136,9 +138,11 @@ export default ({ navigation }) => {
|
||||
idToken = tokenResponse?.id_token;
|
||||
}
|
||||
|
||||
if (!idToken) throw new Error("Jeton Google manquant (échange/retour)");
|
||||
if (!idToken)
|
||||
throw new Error("Jeton Google manquant (échange/retour)");
|
||||
|
||||
const credential = firebase.auth.GoogleAuthProvider.credential(idToken);
|
||||
const credential =
|
||||
firebase.auth.GoogleAuthProvider.credential(idToken);
|
||||
await firebase.auth().signInWithCredential(credential);
|
||||
await afterLoginNavigate();
|
||||
}
|
||||
@@ -167,7 +171,7 @@ export default ({ navigation }) => {
|
||||
hideBackButton
|
||||
>
|
||||
<View style={{ flex: 1, paddingTop: 20 }}>
|
||||
<ItemContainer height={490}>
|
||||
<ItemContainer height={600}>
|
||||
<View style={{ gap: 30, paddingTop: 5, paddingHorizontal: 5 }}>
|
||||
<View style={{ gap: 2 }}>
|
||||
<Text
|
||||
|
||||
Reference in New Issue
Block a user