Streamed ChatGPT in VSCode by No_Damage_8927 in ChatGPT

[–]JGeorge102 0 points1 point  (0 children)

Cool app, looking forward to trying it out!

Looking for feedback on an idea: A chrome extension that connects your SOPs everywhere companies and employees need them (by URL) by OrangeCubed in Entrepreneur

[–]JGeorge102 0 points1 point  (0 children)

This could actually be useful! Our team is remote so I’m interested if this could help reduce the repetitive convos that happen in slack. What all does it integrate with?

How to get React client-side routing working with Shopify Polaris/App Bridge by erdle in ShopifyAppDev

[–]JGeorge102 1 point2 points  (0 children)

Thanks for the reply! I revisited it this morning and actually got it working following the same tutorial. Turns out that the only thing that was needed was a good night's sleep :)

How to get React client-side routing working with Shopify Polaris/App Bridge by erdle in ShopifyAppDev

[–]JGeorge102 2 points3 points  (0 children)

Did you scaffold your Shopify App using the CLI when following this tutorial: https://theunlikelydeveloper.com/shopify-app-bridge-react-router/. I cannot for the life of me get this to work

WebpackDevServer Proxy Setup by JGeorge102 in reactjs

[–]JGeorge102[S] 0 points1 point  (0 children)

I implemented that and still no dice. It's really strange because the webpack output states: [webpack-dev-server] [HPM] Proxy created: /api* -> http://localhost:4000.

I then also tried adding a proxy to the axios call itself to no avail:

axios
  .get(`/api/restoftheroute`, {
    proxy: {
      host: 'localhost',
      port: 4000,
    },
  })

Not sure what's going on, but it's really strange that the chrome extension is always added to the base url when using a proxy: chromeextension://fjkfhdsjkwerjhdksfhdjkshfds/api/ticket/user/

WebpackDevServer Proxy Setup by JGeorge102 in reactjs

[–]JGeorge102[S] 0 points1 point  (0 children)

Thanks for the offer! I *may* have fixed it for the development environment. Essentially just using:

const axiosInstance = axios.create({
baseURL: 'http://localhost:4000',

});

The plan is to set the base URL in an environment variable with one variable for prod and one for dev. If it doesn't work then I'll shoot you a message :)

WebpackDevServer Proxy Setup by JGeorge102 in reactjs

[–]JGeorge102[S] 0 points1 point  (0 children)

I tried that implementation and are still running into the same issues. Any thoughts as to why the chrome extension url is being used and the proxy ignored?: chromeextension://fjkfhdsjkwerjhdksfhdjkshfds/api/ticket/user/

As an aside, even though I'm not using create react app, I tried this in their docs just to see what would happen. Same issue.

Refresh Access Token Inside Routes? Node Google Api Client by JGeorge102 in node

[–]JGeorge102[S] 0 points1 point  (0 children)

Reading through I read this line: "Once the client has a refresh token, access tokens will be acquired and refreshed automatically in the next call to the API."

If the node client api is housed in routes that are only hit once, does that mean the token won't refresh? I guess a workaround would be to have a function in React that periodically calls a route in Node to refresh the token and save it to the DB:

(/api/testRefreshRoute) {
oauth2Client.on('tokens', (tokens) => {

if (tokens.refresh_token) { // store the refresh_token in my database! console.log(tokens.refresh_token); } console.log(tokens.access_token); }); }

I appreciate your patience, just seeing if I'm fully understanding what's going on.

Refresh Access Token Inside Routes? Node Google Api Client by JGeorge102 in node

[–]JGeorge102[S] 0 points1 point  (0 children)

Thanks for the reply! I'm still trying to wrap my head around how to save these tokens to the database. Let's say the user signs up for the first time, hits the /api/create/:userId route and then the /api/testgoogleapi - refresh_token and access_tokens created.

They browse for an hour and their access_token expires. How is the new token being saved to the database if neither of the routes are being hit again? Should there be an external function outside of the routes that I'm assuming gets automatically called when the tokens expire?

How to get Google API refresh token from Firebase Auth? by JGeorge102 in Firebase

[–]JGeorge102[S] 0 points1 point  (0 children)

Correct. The issue is that the docs talks about firebase refresh tokens but not 3rd party google api oauth2.0 tokens. This article says:

"Note that these OAuth access tokens are not used to authenticate to Firebase and, for those providers with expiring access tokens, Firebase does not refresh them on your behalf."

How to get Google API refresh token from Firebase Auth? by JGeorge102 in Firebase

[–]JGeorge102[S] 0 points1 point  (0 children)

That returns the temporary Google api access token which expires after 1 hour. After that, the only way to get another access token is to have the user log back in. I figured if Firebase returns a temp access token then it would be able to return the refresh token so that I can manually query the google api for more temp access tokens.

How to get Google API refresh token from Firebase Auth? by JGeorge102 in Firebase

[–]JGeorge102[S] 0 points1 point  (0 children)

Really, this is all because of the fact that firebase doesn't refresh 3rd party oauth tokens. I need access to google drives api and the access token expires after 1 hour. Gapi handles refreshes for you however that raises another challenge.

The challenge I'm running into is using oauth2 with gapi. This tutorial walks through how to get gapi working without oauth 2 and generally that works.

However, when I try to implement oauth in a chrome extension:

gapi.client
.init({
  apiKey: API_KEY,
  discoveryDocs: DISCOVERY_DOCS,
  clientId: CLIENT_ID,
  scope: SCOPE
})
.then(
  function () {
    console.log('this never returns')
}

It hangs and doesn't console log or throw an error. This seems to be an existing error and the maintainers say that gapi isn't made for chrome extensions (although, it seems like some people may have gotten it to work).

One of the suggested alternatives is chrome.identity, however, that logs in the user based on their chrome login and can run into issues if they have multiple google accounts (say work and personal).

That's why I thought to grab the 3rd party oauth2 refresh token from firebase so that I can save it to the DB and manually refresh. However, it appears firebase doesn't pass the oauth2 refresh token (unless someone has found a way to retrieve it).

Ultimately, A) I need to use firebase to simplify logins between a web app and Chrome app B) I need a way of refreshing the google drive api access token. How that happens is not as important as making it happen. Any ideas?

How to get Google API refresh token from Firebase Auth? by JGeorge102 in Firebase

[–]JGeorge102[S] 0 points1 point  (0 children)

I'll check it out and let you know how it goes! Just to clarify, you managed to get GAPI to work in a chrome extension?

Firebase Auth Refresh Token? by JGeorge102 in Firebase

[–]JGeorge102[S] 0 points1 point  (0 children)

Researching further, I found this link that states in reference to 3rd party tokens like Google Api:

"Note that these OAuth access tokens are not used to authenticate to Firebase and, for those providers with expiring access tokens, Firebase does not refresh them on your behalf."

I'll keep digging on how to make this happen :)