Comments (27)
If I make no calls to snoowrap, I don't see an error thrown.
If I call r.get_hot(), I get this:
from snoowrap.
Thanks for the report -- I'll look into seeing if I can get the browser build to work with Safari.
However, could you clarify what you mean when you say that snoowrap is catching a google maps API error?
from snoowrap.
I think he means that you shouldn't be looking into that error because ExtJS framework might be the cause of it
from snoowrap.
ExtJS is not the cause of it. Loading font awesome or google maps api from
Google servers causes the problem.
Aside from making robots, you'd think this is ideal for making mobile or
browser apps.
On Tue, Jun 28, 2016 at 3:25 PM Hannan Ali [email protected] wrote:
I think he means that you shouldn't be looking into that error because
ExtJS framework might be the cause of it—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#32 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAUHpU0wxaBfpFdikI3IUNpHjp5fiDi9ks5qQZ9jgaJpZM4JAkCM
.
from snoowrap.
This was closed because I fixed the Safari issue, but I guess I'll reopen it for the google maps issue.
Would you mind providing sample code for how you're interacting with google maps/snoowrap? I can't think of how snoowrap would be interfering with your requests to the google maps API.
from snoowrap.
It is ExtJS that is causing Google maps API to be yanked in, locally (e.g.
Not from a cdn). It's probably adding a script tag dynamically.
The issue is that the Maps API is fetching additional js files from cdn.
I've initiated a get_hot request and before it finishes, the Maps API
returns a "not logged in" status. It appears to me snoowrap is trying to
parse that response.
On Tue, Jun 28, 2016 at 5:36 PM not-an-aardvark [email protected]
wrote:
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#32 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAUHpTT-yHaN4KIayeNcDDksIqrnGLcpks5qQb4DgaJpZM4JAkCM
.
from snoowrap.
I see -- what makes you think that snoowrap is trying to parse that response?
(Sorry for asking so many questions, but I'm still not sure I understand what's going on.)
from snoowrap.
Can you see the error snoowrap threw? I included it in one of my previous comments here. That' kind of output is not anything I've seen in any other JavaScript environment.
https://cloud.githubusercontent.com/assets/329637/16433270/380d7b68-3d3e-11e6-962a-4d773fe2a36d.png
Also, the issue only occurs when running the app in emulation mode in the developer tools. The app runs fine as a desktop app. The only difference is font awesome and google maps.
If I comment out snoowrap, the app works in emulation mode.
When I look at the network tab, I see the request to reddit succeeds, then after a few seconds the other requests for google assets succeed but the login auth to google apis fails and the error I see is thrown. The .then() for the reddit request doesn't seem to be called.
What else can I tell you?
from snoowrap.
When I look at the network tab, I see the request to reddit succeeds
What's the endpoint of the request to reddit that succeeds? snoowrap has to make several requests to reddit at first (to get an access token before it can start accessing the API directly).
From that screenshot, it seems like the request to https://oauth.reddit.com/hot?raw_json=1&count=9999 is failing, and that's causing the error that gets thrown. I think the issue with the google API login might be unrelated to snoowrap.
from snoowrap.
I think I see what's going on.
When using the desktop framework, snoowrap is generating an http request to reddit. When running in the mobile framework, snoowrap is generating an https request that is getting a 302 response.
Maybe have a look at what circumstances you are generating https requests?
The URL in my browser is not https.
from snoowrap.
from snoowrap.
Hmm, it seems like reddit is redirecting the OAuth request to its mobile HTML site (http://m.reddit.com) since it identifies that you're on a mobile device based on the user-agent. That could be a bug with the reddit API.
Have you tried using a different user-agent with snoowrap?
from snoowrap.
No, but I could try.
I'm using navigator.userAgent :)
from snoowrap.
I am a bit confused by this, though:
The request URL is https.
from snoowrap.
Using hardcoded user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36"
Still fails.
from snoowrap.
I'm using navigator.userAgent :)
I think that might be what's causing the issue. Reddit has some guidelines here on choosing a good user-agent string; basically, it sometimes does things unexpectedly if it thinks the request is coming from a browser trying to access the normal site.
Try making your user-agent something different, related to your app.
from snoowrap.
I am a bit confused by this, though:
The request URL is https.
That's as intended; in fact, all OAuth requests are required to use https. I'm not sure why reddit redirects to the http:
version of its mobile site, though.
from snoowrap.
I don't know how reddit's server is able to detect mobile browser given that I'm passing giving it a user_agent that is the desktop browser's string.
Some more info:
and
and
those requests are not being redirected...
from snoowrap.
Aha
from snoowrap.
I went ahead and removed the image from your last comment as a precaution, since it contained your client credentials (in the "Authentication" header, encoded in base64). You may want to edit that out of the image.
from snoowrap.
Appreciate it. I fixed the image.
Anyhow, maybe you can override the user-agent header with user_agent configuration/option?
from snoowrap.
In theory snoowrap already does that, and it seems to set the header correctly in node, at least. I'm not sure why it's not working in your authentication request, though.
Just to make sure, are you setting the user-agent option as you construct the snoowrap instance? e.g.
new snoowrap({
user_agent: 'put the custom user-agent string here',
client_id: 'foo',
client_id: 'bar',
refresh_token: 'baz'
})
from snoowrap.
I removed the client_id, etc., strings for security reasons :)
from snoowrap.
I can reproduce this. It seems like the user-agent header gets ignored when making requests from browsers.
from snoowrap.
Awesome.
Now the question is if you can figure out how to override the header or contact Reddit and ask about the redirect.
from snoowrap.
Also, I appreciate your patience and looking at this.
from snoowrap.
I decided to make another ticket for the user-agent issue (see #33) and close this one, since the original issue of const
not working in safari should be fixed in the next update.
from snoowrap.
Related Issues (20)
- SubmitLinkOptions type declaration marks subredditName as non-optional, but is autofilled in javascript source HOT 1
- removal_reason null for moderator-removed comments HOT 3
- Subreddit missing type declarations for recently added features
- Missing types on Submission
- Improve docs inter-links
- Enhancement: Fetch subreddit metadata HOT 1
- reddit account activity log "unknown user-agent" for web app
- Unable to get it working on the browser
- snoowrap and the future HOT 9
- How to use .fetch("subreddit", {after: ...., before: ....}) ???? HOT 2
- How to use proxy in snoowrap? HOT 2
- How to get comments from a Submission?
- Can you send chat message instead of DM using snoowrap?
- Recieving Invalid grant Error even though all credentials are correct. HOT 1
- webpack pollyfills
- `request` has a CVE and is deprecated, any plans to publish a version that addresses this vulnerability HOT 1
- FetchAll() throwing : TypeError: Cannot assign to read-only property '_bitField'
- When I send a post I receive a Submission but I have access only to the name HOT 2
- Is There Anyway To Change The Kind
- getSubreddit(name).getNew({limit}) doesn't work HOT 1
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 snoowrap.