Giter VIP home page Giter VIP logo

Comments (5)

szich avatar szich commented on September 4, 2024

This is tricky to figure out with the given information. We use it on our live server with no issues, so I know 'it works' at least in our environment.

Do you get an HTTPAuthorizationFailed for every request or just for some of them?

Are you using a single refresh token for the app, or does each user have their own?

Do you use any caching?

from google_calendar.

bfosberry avatar bfosberry commented on September 4, 2024

The flow is basically this

App is configured with client id and secret, as well as calendar id. Once app starts up, using standard oauth flow, user (calendar owner) gets a refresh token using omniauth. This token is stored for future use.

Calendar api is initialized with the same client id and secret used for oauth.

This process will work locally, however when pushed to a server (heroku app) it successfully gets an oauth token, but fails to connect via the calendar api. The only difference I can tell between the two environments is possible issues around origin and callback urls.

The token has greater scopes than just calendar, but the app is not configured to use strict scopes.

from google_calendar.

szich avatar szich commented on September 4, 2024

Make sure your origin and callback urls match those that you are using on the live server. You can setup multiple entries for both fields in the google developers console.

if that doesn't work add some logging to the Connection::send method and we'll go from there.

from google_calendar.

bfosberry avatar bfosberry commented on September 4, 2024

Thanks for the help, I added some debug code but it ended up not being a huge help.

My issue seemed to be one or all of several issues.

  1. I was not explicitly requesting access_type offline for the token. Offline is the omniauth default but it does not seem to necessarily request it on it's own.

  2. Somehow I had a mismatch between my client ids and secrets (OR when I changed something it regenerated a secret)

  3. I was using the client ID not the client email.

Note: I never received an Oauth failure, oauth ALWAYS worked, but rather calendar login failed. After changing these things randomly, things began to work. Perhaps oauth sessions get cached google-side preventing new changes from taking place, and from auth issues from being seen further down the line. Quite bizzare.

So it seems to be working now, still no idea why it worked locally. It must have been a token cached by google that caused the issue.

thanks for the help, and watch out for these issues!

from google_calendar.

szich avatar szich commented on September 4, 2024

Thanks for following up. Hopefully this will save someone else some time.

from google_calendar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.