Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
NigelBreslaw committed Feb 10, 2024
1 parent f850e2a commit f97f98b
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy-gg-web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 5 additions & 7 deletions native_gg/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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("");
Expand All @@ -21,15 +21,13 @@ export default function App() {
contentFit="contain"
source="https://d33wubrfki0l68.cloudfront.net/554c3b0e09cf167f0281fda839a5433f2040b349/ecfc9/img/header_logo.svg"
/>
<Auth setToken={setToken} setMembershipID={setMembershipID} />
<AuthUI setToken={setToken} setMembershipID={setMembershipID} />
<Text style={{ fontSize: 22, marginTop: 15, color: "#150f63" }}>
Auth token: <Text style={{ fontWeight: "bold" }}>{token}</Text>
</Text>
{membershipID && (
<Text style={{ fontSize: 22, marginTop: 15, color: "#150f63" }}>
Membership ID: <Text style={{ fontWeight: "bold" }}>{membershipID}</Text>
</Text>
)}
<Text style={{ fontSize: 22, marginTop: 15, color: "#150f63" }}>
Membership ID: <Text style={{ fontWeight: "bold" }}>{membershipID}</Text>
</Text>
<StatusBar style="auto" />
</View>
);
Expand Down
6 changes: 3 additions & 3 deletions native_gg/src/AuthUI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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(() => {
Expand Down
2 changes: 1 addition & 1 deletion native_gg/src/Authentication.ts
Original file line number Diff line number Diff line change
@@ -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<JSON> {
// {
Expand Down
8 changes: 3 additions & 5 deletions native_gg/src/constants/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

0 comments on commit f97f98b

Please sign in to comment.