Skip to content

Conversation

@ccbrown
Copy link
Contributor

@ccbrown ccbrown commented Jul 7, 2024

This PR makes the docs site able to accept JWTs in addition to static API keys.

Copy link
Contributor Author

ccbrown commented Jul 7, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @ccbrown and the rest of your teammates on Graphite Graphite

@ccbrown ccbrown requested a review from ashukur July 7, 2024 01:24
@ccbrown ccbrown marked this pull request as ready for review July 7, 2024 01:24
@ccbrown ccbrown force-pushed the 07-06-accept_fusionfeed_jwts branch from bdf4b73 to beeb9bd Compare July 7, 2024 01:25
const url = publicRuntimeConfig.fusionFeedUrl + '/v2/graphql';
const subscriptionUrl = publicRuntimeConfig.fusionFeedUrl + '/v2/graphql-ws';
const token = cookie.get('fftoken');
const tokenType = token?.includes('.') ? 'Bearer' : 'token';
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assuming checking for "." here works because we are joining two strings with that as the separator ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JWTs are always in HEADER.PAYLOAD.SIGNATURE format. And our API keys never have dots. So if it has at least one dot, it's a JWT.

Copy link

@ashukur ashukur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM assuming that the "." is a reliable way to say something is a Bearer token

@ccbrown ccbrown merged commit 8aee857 into main Jul 16, 2024
Copy link
Contributor Author

ccbrown commented Jul 16, 2024

Merge activity

@ccbrown ccbrown deleted the 07-06-accept_fusionfeed_jwts branch July 16, 2024 01:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants