The Movie Database Support

Hi.

I am new to Movie API. And I am stuck with 403 Error.

When I run my app I see API for one second and after that I get 403 with message like this:

"403 ERROR
The request could not be satisfied.
Request blocked. We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.
If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.
Generated by cloudfront (CloudFront)
Request ID: RgHrk_Tceg-jH7-Qsqqoc6yHoeiWhgpnrpYu5uN35Ahn2E_jgxv8OA=="

I created API key and tested it on your website and got OK 200 status. But when I try to implement it on my app I stuck.

Many thanks for your help.

5 replies (on page 1 of 1)

Jump to last post

Hi @ParaNo1d,

Double check that you're not sending a request body along with your GET request. There's two other examples that I know of in JavaScript and PHP here and here. There's a clear cURL example in the first link.

Cheers.

@travisbell said:

Hi @ParaNo1d,

Double check that you're not sending a request body along with your GET request. There's two other examples that I know of in JavaScript and PHP here and here. There's a clear cURL example in the first link.

Cheers.

Hi again.

This is my Network.js and I don't see that I sending body with GET. Do I missing something?

import config from '../config/index'
import {storageService, storageKeys} from '../mixins/storageService'

class Network {
    static methods = {
        GET: 'GET',
        POST: 'POST'
    }

    addApiKey(url) {
        return `${url}?api_key=${config.API_KEY}`
    }

    addSessionId(url) {
        const sessionId = storageService.methods.storageGet(storageKeys.SESSION_ID)
            return sessionId ? `${url}&session_id=${sessionId}` : url
    }

    constructUrl(url, queryParams) {
        url = this.addApiKey(`${config.API_BASE_URL}${url}`)
        url = this.addSessionId(url)

        for (let key in queryParams) url += `&${key}=${queryParams[key]}`
            return url
    }

    async fetch(url, method, options = {}) {
        const res = await fetch(this.constructUrl(url, options.params), {
            method,
            body: JSON.stringify(options.data),
            headers: {
                'Accept': 'application/json, text/plain, */*',
                'Content-Type': 'application/json'
            }
        })
        return await res.json()
    }
}

export default Network
code text here

I am not familiar with what exactly you're doing there but if you're trying to execute a GET request, my guess is you are sending a request body given this line:

body: JSON.stringify(options.data),

Make sure when you're issuing a GET, you're not setting that line.

@travisbell said:

I am not familiar with what exactly you're doing there but if you're trying to execute a GET request, my guess is you are sending a request body given this line:

body: JSON.stringify(options.data),

Make sure when you're issuing a GET, you're not setting that line.

I'm still not sure what I am missing here.

Can you please check my repo on GitHub?

https://github.com/ivanradunkovic/MovieApp

Hi.

I just fixed this 403 CloudFront response by adding a User-Agent header in my curl request.

curl_setopt($ch, CURLOPT_USERAGENT, 'PHP-myapp');

Can't find a movie or TV show? Login to create it.

Want to rate or add this item to a list?

Login