-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs(gatsby-plugin-guess-js): Document JWT #15969
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this is valuable! Just added a question & a small change.
@@ -36,6 +36,8 @@ module.exports = { | |||
options: { | |||
// Find the view id in the GA admin in a section labeled "views" | |||
GAViewID: `VIEW_ID`, | |||
// Add JWT token to perform authentication on deployment builds | |||
jwt: GA_JWT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you explain what GA_JWT holds?
For gatsbyjs.org we're doing the following to make it work:
jwt: {
client_email: process.env.ANALYTICS_SERVICE_ACCOUNT,
private_key: process.env.ANALYTICS_SERVICE_ACCOUNT_KEY,
},
ENV vars look like:
ANALYTICS_SERVICE_ACCOUNT="<name>@<project>.iam.gserviceaccount.com"
ANALYTICS_SERVICE_ACCOUNT_KEY="-----BEGIN PRIVATE KEY-----\nPRIVATE KEY STRING\n-----END PRIVATE KEY-----"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very good point, tried to follow the rabbit hole into Guess webpack and ga packages but haven't been able to work out where this goes yet. I can see that client_email, private_key combo in www/
but it appears to be commented out currently?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a bug with guess so that's why :)
|
||
## How to get a JWT token? | ||
|
||
[Here](https://2ality.com/2015/10/google-analytics-api.html) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like we should just copy and modify https://2ality.com/2015/10/google-analytics-api.html#unlocking-the-google-analytics-api in the readme and give credits to 2ality url.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another good point, I would probably be welcome to more suggestions as to how to do this in a simpler way (if possible?).
Maybe attaching something to a gatsby preBuild api to get a fresh JWT. My knowledge on JWT is a little limited but I would assume that this wouldn't be the best way as each JWT is valid until you make it non valid correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like there is already a PR open to create some changes to the documentation which opened a week before you #15774. I'll be closing this one.
We absolutely want to have you as a contributor, so please take a look at our open issues for ideas, and please reach out to us on Twitter at @gatsbyjs with questions.
We offer pair programming sessions if you’d like to work with one of our maintainers to make another contribution.
Thanks again, and we look forward to seeing more PRs from you in the future! 💪💜
@@ -36,6 +36,8 @@ module.exports = { | |||
options: { | |||
// Find the view id in the GA admin in a section labeled "views" | |||
GAViewID: `VIEW_ID`, | |||
// Add JWT token to perform authentication on deployment builds | |||
jwt: GA_JWT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a bug with guess so that's why :)
My mood changes fast 😂. Let's re-open this one and wait for #15774 to get merged and get some of your updates in as well. So you can get credit for your work! 💪 |
🙈 totally missed that! Very similar to my changes yep. I think it would be really beneficially to add a solution to get the JWT from google in there as well! |
I would copy the first step of https://2ality.com/2015/10/google-analytics-api.html. Add a small paragraph that the token will expire in x time. If you need to update your token automatically please read https://2ality.com/2015/10/google-analytics-api.html That's how I would suggest it 🤷♂ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Holy buckets, @omonk — we just merged your PR to Gatsby! 💪💜 Gatsby is built by awesome people like you. Let us say “thanks” in two ways:
If there’s anything we can do to help, please don’t hesitate to reach out to us: tweet at @gatsbyjs and we’ll come a-runnin’. Thanks again! |
@sidharthachatterjee Sorry for my delayed response, have been on holiday! Thanks very much for merging that! |
I hope you had an awesome vacation! 🌴 Thanks for your work! |
Description
gatsby-plugin-guess-js
is able to accept a JWT for authenticating the plugin on deployment services.The documentation previously didn't have any mention about how to use this on deployment services as locally it requires human interaction to grant permissions.
Related Issues
guess-js/gatsby-guess#19 (comment)
#15582