#That link shows an example access token
1 messages · Page 1 of 1 (latest)
This is what I get when I use their example token
Basic OmQ2ZDJjMDI2YmFjNDRiMWVhN2FjMDMzMjY5NGE4MzBl
It seems to match the data in the docs ._.
No idea, then. If there's a way to dump the request object you construct in Unity, try that, and compare with the one in Postman
And make sure the request actually returns one of the success HTTP status codes
Yeah... I'll keep looking into this, debbuging these backend calls has been hell so far... thanks
Oh, would it help when I said I'm getting the
{"code":3,"details":["token not found"],"reason":"Unauthenticated"} response when I call it from my snippet above?
Hmmm seems like it's not detecting the header?
You're getting a HTTP 400 right? Because that code 3 is valid for multiple responses
I'd expect a 401 or 403 for authentication or authorization issues, but they're not returned (or documented) for the endpoint
Oh what you can do is remove the header in Postman, and see if you get the same response as in Unity!
And check the error message if you put a blatantly wrong token. I've seen bad APIs that don't distinguish "no token header" (that should return a 400) and "invalid token" (401), so test everything
Ah, I think Unity is being interesting again and re-directing requests to /content somewhere else, which, by default, does not re-include the authorization header to the subsequent endpoint for security purposes (I think). Postman seems to handle this fine where it automatically follows the re-direct, but in C# it might not be the case
I'll try re-including the Auth header for redirects and see if that fixes something, but I hope to one day understand the purpose of all of these redirects
It's weird that it redirects like that, are you sure the endpoint you're using isn't deprecated or something?
Granted it says "temporary", but if it's been like that for a while, something is definitely wrong
You could try requesting the Location present in the response header directly to avoid the redirect hell
It's the first "GetContentForEntry" endpoint that's not marked as deprecated, so it should be fine. I've tested the code and it works now, redirect was the issue. I'm preventing auto-following redirects and manually re-sending them with adequate auth header for ever 300 response I get