Skip to content

Instantly share code, notes, and snippets.

@vdhanan
Created May 20, 2024 14:34
Show Gist options
  • Save vdhanan/e1768cdec753add5d64a2d4027d8f177 to your computer and use it in GitHub Desktop.
Save vdhanan/e1768cdec753add5d64a2d4027d8f177 to your computer and use it in GitHub Desktop.
clear access token
diff --git a/lib/utils/services-utils.js b/lib/utils/services-utils.js
index 684f444314..c22609665e 100644
--- a/lib/utils/services-utils.js
+++ b/lib/utils/services-utils.js
@@ -7,7 +7,7 @@ import type { AuthMetadata } from '../shared/identity-client-context.js';
// If this is true then we're using the identity service for auth. After we
// auth, the identity service gives us a CSAT, which we can use to auth with
// other Comm services.
-const usingCommServicesAccessToken = false;
+const usingCommServicesAccessToken = true;
// If this is true, then the app is able to support multiple keyservers. This
// requires the use of Tunnelbroker and the backup service to persist and sync
diff --git a/native/components/access-token-handler.react.js b/native/components/access-token-handler.react.js
index c2d9f2fa27..a639cd6a67 100644
--- a/native/components/access-token-handler.react.js
+++ b/native/components/access-token-handler.react.js
@@ -16,6 +16,7 @@ function AccessTokenHandler(): React.Node {
void (async () => {
const { accessToken } =
await commCoreModule.getCommServicesAuthMetadata();
+ console.log(accessToken);
dispatch({
type: setAccessTokenActionType,
payload: accessToken ?? null,
@@ -28,6 +29,7 @@ function AccessTokenHandler(): React.Node {
const subscription = metadataEmitter.addListener(
'commServicesAuthMetadata',
(authMetadata: UserAuthMetadata) => {
+ console.log(authMetadata);
dispatch({
type: setAccessTokenActionType,
payload: authMetadata.accessToken,
diff --git a/native/profile/dev-tools.react.js b/native/profile/dev-tools.react.js
index f8833178fd..e8af1ea615 100644
--- a/native/profile/dev-tools.react.js
+++ b/native/profile/dev-tools.react.js
@@ -196,6 +196,15 @@ class DevTools extends React.PureComponent<Props> {
Wipe state and kill app
</Text>
</Button>
+ <Button
+ onPress={this.onPressClearAccessToken}
+ style={this.props.styles.row}
+ iosFormat="highlight"
+ iosHighlightUnderlayColor={underlay}
+ iosActiveOpacity={0.85}
+ >
+ <Text style={this.props.styles.redText}>Clear token</Text>
+ </Button>
</View>
<Text style={this.props.styles.header}>SERVER</Text>
<View style={this.props.styles.slightlyPaddedSection}>
@@ -218,6 +227,13 @@ class DevTools extends React.PureComponent<Props> {
await wipeAndExit();
};
+ onPressClearAccessToken = () => {
+ this.props.dispatch({
+ type: 'SET_ACCESS_TOKEN',
+ payload: null,
+ });
+ };
+
onSelectServer = (server: string) => {
if (server !== this.props.urlPrefix) {
this.props.dispatch({
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment