Comments (7)
Hi, and thanks for reporting. Could you share a snippet of the code you're using (or at least the code you're using to debug the issue?)
Thanks.
from cloudprint.
Hi there,
I have this
client = CloudPrint::Client.new(client_id: Settings.google.cloudprint.key, client_secret: Settings.google.cloudprint.secret)
redirect_url = Settings.urls.root + "/cloudprint/callback"
token = client.auth.generate_token(params[:code], redirect_url)
When running the last line is when I get the error.
from cloudprint.
OK, so I take it that the third line is in a separate controller under the callback action for CloudPrint. Have you confirmed that params[:code]
is not nil when you try to generate the token?
Also, I'm not sure what you mean by 'we try to hit the endpoint on Google again.' Generating the refresh token can only be done once -- after the very first time users sign in, when they are redirected back to your application. You have to save the token there and then and reuse it from that point on.
from cloudprint.
The params[:code]
is not nil
, I've checked.
So, a User
in my application can have multiple Organization
, for each Organization
I need to allow access to Google Cloud Print, but since they already gave access for, lets say, the first Organization
, it doesn't work for the second one.
from cloudprint.
OK, so are you trying to generate more than one refresh token from the same code? Because that won't work. If that's what you're trying, you should share the refresh token between multiple orgs instead.
If not, I'm afraid I'll need to see a minimal example that I can run on my end to reproduce this bug.
from cloudprint.
Ok, I'll change the code on my end and try a different approach, thanks 👍
from cloudprint.
For future reference, since I spent some time figuring this out: If you try to re-auth, it will fail, because you already have received a valid authentication previously. To work around this, append &prompt=consent
to the auth_url. E.g.:
client.auth.generate_url(redirect_url) + "&prompt=consent"
We might want to make this default behaviour and/or document it in the readme.
from cloudprint.
Related Issues (20)
- Rewrite the HTTP code to use Faraday.
- Update Documentation/Readme HOT 1
- Make gem more powerful HOT 1
- Automate the process of authenticating.
- CloudPrint return nil after used .print method HOT 4
- client.auth method does not exist HOT 1
- Ruby on Rails HOT 1
- undefined method `auth` HOT 5
- Trying to print returns nil HOT 5
- Can't print PDF google drive HOT 4
- Change Paper Size HOT 2
- PDF not align properly. HOT 2
- UI State not available on print job HOT 1
- Example of actually printing a PDF file? HOT 3
- Unable to Connect to google
- Failure to open TCP connection HOT 1
- Net::ReadTimeout: Net::ReadTimeout
- search_all delegates to invalid query HOT 4
- Update dependency versions HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cloudprint.