Joel
Joel

Reputation: 1635

YouTube API v3 Error: 403 but the API key is configured and Bundle identifier is correct

I need to pull the name of a specific channels playlists from youtube. I am using AFJSONRequestOperation to make the call.

I keep getting the error code "Expected status code in (200-299), got 403". I have registered with google and my bundle identifier is correct.

Here is My code (I crossed out the last ten characters of my api KEY):

   NSURL *url = [[NSURL alloc] initWithString:@"https://www.googleapis.com/youtube/v3/playlists?part=snippet&channelId=UCHvTZKuI5zQnxmbgSE-CFug&maxResults=50&key=AIzaSyDHU-hMgwLf0a4vZe4pPDxqyxxxxxxxxxx"];
NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url];


AFJSONRequestOperation *operation = [AFJSONRequestOperation
                                     JSONRequestOperationWithRequest:request
                                     success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON){
                                         NSLog(@"%@,",JSON[0][@"title"]);

                                     }failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, id JSON){
                                         NSLog( @"NSError: %@", error.localizedDescription);

                                     }];

[operation start];

The solutions I have tried are as follows: - Using the browser key. - Regenerating the key. - Triple checking the bundle identifier. - have added the google cloud api's and the youtube analytics and the youtube data api.

Any Suggestions?

Thanks in advance, -Joel

Upvotes: 2

Views: 1437

Answers (1)

user3781236
user3781236

Reputation: 728

This seems to be a bug - I fixed it by removing the bundle identifier from my registered app.

Upvotes: 1

Related Questions