Ryan Rich
Ryan Rich

Reputation: 12055

Getting Status: 403 Forbidden when checking my github scopes

So I'm running through the github oauth api and I'm having some issues getting my client_id to authenticate.

When I pass my client_id manually through a URL like so:

<a href="https://github.com/login/oauth/authorize client_id=clientidhere">

I get a 404 not found from github. A quick search and I'm told that the issue is one of two things: you’re either not authenticating correctly, or your scopes aren't valid.

So I run the authentication command once again:

curl -i -u myun https://api.github.com/users/myun

And then check my scopes:

curl -H "Authorization: bearer mytoken" https://api.github.com/users/myun -I

From there I'm still getting 401 not authorized. Full output:

HTTP/1.1 403 Forbidden
Server: GitHub.com
Date: Fri, 26 Jul 2013 03:14:13 GMT
Content-Type: application/json; charset=utf-8
Status: 403 Forbidden
X-GitHub-Media-Type: github.beta
Content-Length: 61
Access-Control-Allow-Credentials: true
Access-Control-Expose-Headers: ETag, Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-  
RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes
Access-Control-Allow-Origin: *

Any insight on this issue is appreciated.

EDIT: After running curl -i -u myun https://api.github.com/users/myun once again and then rechecking the scope I get a status of Status: 200 OK...however. When I try the link again I still get 404 not found from github.

So now that I've exhausted both of github's suggestions[1] on why I'm receiving the 404 where do I go? I'm almost certain it's not an issue with the api.

  1. http://developer.github.com/v3/troubleshooting/#why-am-i-getting-a-404-error-on-a-repository-that-exists

Upvotes: 1

Views: 1093

Answers (1)

Ian Stapleton Cordasco
Ian Stapleton Cordasco

Reputation: 28717

Your first URL does not look correct, it should be:

<a href="https://github.com/login/oauth/authorize?client_id=clientidhere">

Emphasis on the missing ?.

Second, you should always include a redirect_uri but that isn't the reason you're seeing a 404. You're seeing a 404 on that link because the browser is interpreting what you have as https://github.com/login/oauth/authorize%20client_id=clientidhere.

I'm not sure what token you're using but you don't appear to be displaying the full headers that show us what OAuth-Scopes you actually have. I might be wrong but I think even on a 4xx error you get that information back.

Also the troubleshooting page you linked to is about trying to see a private repository. In one of the examples they list in that section, they show you what the header should look like that is returned. We need that to help you any further.

Upvotes: 1

Related Questions