From f97f98b2a1cefe14915f5136df882616a1083561 Mon Sep 17 00:00:00 2001 From: Nigel Breslaw Date: Sat, 10 Feb 2024 14:47:27 +0200 Subject: [PATCH] Test --- .github/workflows/deploy-gg-web.yml | 2 +- native_gg/App.tsx | 12 +++++------- native_gg/src/AuthUI.tsx | 6 +++--- native_gg/src/Authentication.ts | 2 +- native_gg/src/constants/env.ts | 8 +++----- 5 files changed, 13 insertions(+), 17 deletions(-) diff --git a/.github/workflows/deploy-gg-web.yml b/.github/workflows/deploy-gg-web.yml index 251a90069..a8b5ba5e7 100644 --- a/.github/workflows/deploy-gg-web.yml +++ b/.github/workflows/deploy-gg-web.yml @@ -23,7 +23,7 @@ jobs: - name: install dependencies run: pnpm install --frozen-lockfile - name: add .env file - run: echo ${{ secrets.CLIENT_SECRETS }} > .env + run: pwd && echo ${{ secrets.CLIENT_SECRETS }} > .env && cat .env - name: build run: pnpm expo export -p web - name: deploy website diff --git a/native_gg/App.tsx b/native_gg/App.tsx index 0c6bf7678..36b7f11a4 100644 --- a/native_gg/App.tsx +++ b/native_gg/App.tsx @@ -3,7 +3,7 @@ import { StyleSheet, Text, View } from "react-native"; import { Image } from "expo-image"; import { LinearGradient } from "expo-linear-gradient"; import { useState } from "react"; -import Auth from "./src/AuthUI.tsx"; +import AuthUI from "./src/AuthUI.tsx"; export default function App() { const [token, setToken] = useState(""); @@ -21,15 +21,13 @@ export default function App() { contentFit="contain" source="https://d33wubrfki0l68.cloudfront.net/554c3b0e09cf167f0281fda839a5433f2040b349/ecfc9/img/header_logo.svg" /> - + Auth token: {token} - {membershipID && ( - - Membership ID: {membershipID} - - )} + + Membership ID: {membershipID} + ); diff --git a/native_gg/src/AuthUI.tsx b/native_gg/src/AuthUI.tsx index 817358318..f8cc4f6c3 100644 --- a/native_gg/src/AuthUI.tsx +++ b/native_gg/src/AuthUI.tsx @@ -3,7 +3,7 @@ import * as WebBrowser from "expo-web-browser"; import { useEffect } from "react"; import { Button, Platform } from "react-native"; import { randomUUID } from "expo-crypto"; -import { appID, redirectURL } from "./constants/env.ts"; +import { clientID, redirectURL } from "./constants/env.ts"; import { getAuthToken } from "./Authentication.ts"; type InitialAuthJWT = { @@ -21,9 +21,9 @@ type AuthProps = { }; const stateID = randomUUID(); -const authURL = `https://www.bungie.net/en/oauth/authorize?client_id=${appID}&response_type=code&reauth=true&state=${stateID}`; +const authURL = `https://www.bungie.net/en/oauth/authorize?client_id=${clientID}&response_type=code&reauth=true&state=${stateID}`; -export default function Auth(props: AuthProps) { +export default function AuthUI(props: AuthProps) { const url = useURL(); useEffect(() => { diff --git a/native_gg/src/Authentication.ts b/native_gg/src/Authentication.ts index 656982606..477c39573 100644 --- a/native_gg/src/Authentication.ts +++ b/native_gg/src/Authentication.ts @@ -1,4 +1,4 @@ -import { apiKey, appID, clientID, clientSecret } from "./constants/env.ts"; +import { apiKey, clientID, clientSecret } from "./constants/env.ts"; export function getAuthToken(bungieCode: string): Promise { // { diff --git a/native_gg/src/constants/env.ts b/native_gg/src/constants/env.ts index c784d2efc..2b1414c0f 100644 --- a/native_gg/src/constants/env.ts +++ b/native_gg/src/constants/env.ts @@ -3,14 +3,12 @@ import { Platform } from "react-native"; // @ts-ignore export const apiKey = process.env.EXPO_PUBLIC_API_KEY; // @ts-ignore -export const clientID = process.env.EXPO_PUBLIC_CLIENT_ID; +export const clientID = "46261"; //process.env.EXPO_PUBLIC_CLIENT_ID; // @ts-ignore -export const clientSecret = process.env.EXPO_PUBLIC_CLIENT_SECRET; +export const clientSecret = "qVT6lYzc-t00NiqSRJc8lwbqdXuDMAweEt5-QDF3SU0"; //process.env.EXPO_PUBLIC_CLIENT_SECRET; const isLocalWeb = process.env.NODE_ENV === "development" && Platform.OS === "web"; -const localWebAppID = "46261"; -const normalAppID = "46250"; + const localWebRedirectURL = "https://localhost:19006/auth"; const normalRedirectURL = "https://guardianghost.com/auth"; export const redirectURL = isLocalWeb ? localWebRedirectURL : normalRedirectURL; -export const appID = isLocalWeb ? localWebAppID : normalAppID;