Code that once returned Git Installation Access Token no longer does so
Some time ago I provided this answer to a question. the code sample is one which I've used in several applications without any issue.
Now, I'm trying to use it again but when I run it I get this error:
TypeError: Cannot read property 'access_tokens_url' of undefined
The access_tokens_url isn't in the response as you can see:
status: 200,
statusText: 'OK',
headers:
server: 'GitHub.com',
date: 'Tue, 13 Nov 2018 19:48:12 GMT',
'content-type': 'application/json; charset=utf-8',
'content-length': '2',
connection: 'close',
status: '200 OK',
'cache-control': 'public, max-age=60, s-maxage=60',
vary: 'Accept',
etag: '"5b49dc572fac1de90f6dcbe96af712d9"',
'x-github-media-type': 'github.machine-man-preview; format=json',
'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type',
'access-control-allow-origin': '*',
'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
'x-frame-options': 'deny',
'x-content-type-options': 'nosniff',
'x-xss-protection': '1; mode=block',
'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
'content-security-policy': 'default-src 'none'',
'x-github-request-id': 'F6A0:223A:3E7AF15:7F929C0:5BEB2A7B' ,
config:
adapter: [Function: httpAdapter],
transformRequest: '0': [Function: transformRequest] ,
transformResponse: '0': [Function: transformResponse] ,
timeout: 0,
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
validateStatus: [Function: validateStatus],
headers:
Accept: 'application/vnd.github.machine-man-preview+json',
Authorization: 'Bearer blablabla',
'User-Agent': 'axios/0.18.0' ,
method: 'get',
url: 'https://api.github.com/app/installations',
data: undefined ,
request:
ClientRequest
domain: null,
_events:
socket: [Function],
abort: [Function],
aborted: [Function],
error: [Function],
timeout: [Function],
prefinish: [Function: requestOnPrefinish] ,
_eventsCount: 6,
_maxListeners: undefined,
output: ,
outputEncodings: ,
outputCallbacks: ,
outputSize: 0,
writable: true,
_last: true,
upgrading: false,
chunkedEncoding: false,
shouldKeepAlive: false,
useChunkedEncodingByDefault: false,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: 0,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket:
TLSSocket
_tlsOptions: [Object],
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
_SNICallback: null,
servername: null,
npnProtocol: undefined,
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object],
_eventsCount: 9,
connecting: false,
_hadError: false,
_handle: null,
_parent: null,
_host: 'api.github.com',
_readableState: [Object],
readable: false,
domain: null,
_maxListeners: undefined,
_writableState: [Object],
writable: false,
allowHalfOpen: false,
_bytesDispatched: 626,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: null,
_requestCert: true,
_rejectUnauthorized: true,
parser: null,
_httpMessage: [Circular],
read: [Function],
_consuming: true,
_idleNext: null,
_idlePrev: null,
_idleTimeout: -1,
[Symbol(asyncId)]: 24,
[Symbol(bytesRead)]: 937 ,
connection:
TLSSocket
_tlsOptions: [Object],
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
_SNICallback: null,
servername: null,
npnProtocol: undefined,
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object],
_eventsCount: 9,
connecting: false,
_hadError: false,
_handle: null,
_parent: null,
_host: 'api.github.com',
_readableState: [Object],
readable: false,
domain: null,
_maxListeners: undefined,
_writableState: [Object],
writable: false,
allowHalfOpen: false,
_bytesDispatched: 626,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: null,
_requestCert: true,
_rejectUnauthorized: true,
parser: null,
_httpMessage: [Circular],
read: [Function],
_consuming: true,
_idleNext: null,
_idlePrev: null,
_idleTimeout: -1,
[Symbol(asyncId)]: 24,
[Symbol(bytesRead)]: 937 ,
_header: 'GET /app/installations HTTP/1.1rnAccept: application/vnd.github.machine-man-preview+jsonrnAuthorization: Bearer blablablarnUser-Agent: axios/0.18.0rnHost: api.github.comrnConnection: closernrn',
_onPendingData: [Function: noopPendingOutput],
agent:
Agent
domain: null,
_events: [Object],
_eventsCount: 1,
_maxListeners: undefined,
defaultPort: 443,
protocol: 'https:',
options: [Object],
requests: ,
sockets: [Object],
freeSockets: ,
keepAliveMsecs: 1000,
keepAlive: false,
maxSockets: Infinity,
maxFreeSockets: 256,
maxCachedSessions: 100,
_sessionCache: [Object] ,
socketPath: undefined,
timeout: undefined,
method: 'GET',
path: '/app/installations',
_ended: true,
res:
IncomingMessage
_readableState: [Object],
readable: false,
domain: null,
_events: [Object],
_eventsCount: 3,
_maxListeners: undefined,
socket: [Object],
connection: [Object],
httpVersionMajor: 1,
httpVersionMinor: 1,
httpVersion: '1.1',
complete: true,
headers: [Object],
rawHeaders: [Array],
trailers: ,
rawTrailers: ,
upgrade: false,
url: '',
method: null,
statusCode: 200,
statusMessage: 'OK',
client: [Object],
_consuming: true,
_dumped: false,
req: [Circular],
responseUrl: 'https://api.github.com/app/installations',
redirects: ,
read: [Function] ,
aborted: undefined,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
_redirectable:
Writable
_writableState: [Object],
writable: true,
domain: null,
_events: [Object],
_eventsCount: 2,
_maxListeners: undefined,
_options: [Object],
_redirectCount: 0,
_redirects: ,
_requestBodyLength: 0,
_requestBodyBuffers: ,
_onNativeResponse: [Function],
_currentRequest: [Circular],
_currentUrl: 'https://api.github.com/app/installations' ,
[Symbol(outHeadersKey)]:
accept: [Array],
authorization: [Array],
'user-agent': [Array],
host: [Array] ,
data:
I'm trying to spot if anything is different in my code but I can't see anything. Is it possible something has changed with the APII and if so, how can I resolve this issue?
Additional Info.
This curl command:
curl -i -H "Authorization: Bearer blablabla" -H "Accept: application/vnd.github.machine-man-preview+json" https://api.github.com/app/installations
should also return the data response but with it I get:
HTTP/1.1 200 OK
Server: GitHub.com
Date: Wed, 14 Nov 2018 20:43:04 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 5
Status: 200 OK
Cache-Control: public, max-age=60, s-maxage=60
Vary: Accept
ETag: "5b49dc572fac1de90f6dcbe96af712d9"
X-GitHub-Media-Type: github.machine-man-preview; format=json
Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type
Access-Control-Allow-Origin: *
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
X-Frame-Options: deny
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
Content-Security-Policy: default-src 'none'
X-GitHub-Request-Id: E867:223A:47CF7F2:924E87D:5BEC88D8
[
]
so I don't think it's my code.
As I see it there is either an option with GitHub or with the way I've configured the GitHub app. An ideas?
Additional Info 2
A possible step further! I noticed the GitHub ap wasn't installed so I've that done now. The issue I'm having now is that when I execut my program I get this:
Unable to authenticate
Additional Info 3
I regenerated my PEM key. Now I'm getting this:
HttpError: "message":"Validation Failed","errors":["message":"The listed users and repositories cannot be searched either because the resources do not exist or you do not have permission to view them.","resource":"Search","field":"q","code":"invalid"],"documentation_url":"https://developer.github.com/v3/search/"
at response.text.then.message (/Users/me/git/issue-tracker/node_modules/@octokit/rest/lib/request/request.js:72:19)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
name: 'HttpError',
code: 422,
status: undefined,
headers:
'access-control-allow-origin': '*',
'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type',
'cache-control': 'no-cache',
connection: 'close',
'content-length': '306',
'content-security-policy': 'default-src 'none'',
'content-type': 'application/json; charset=utf-8',
date: 'Thu, 15 Nov 2018 21:14:49 GMT',
'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
server: 'GitHub.com',
status: '422 Unprocessable Entity',
'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
'x-content-type-options': 'nosniff',
'x-frame-options': 'deny',
'x-github-media-type': 'github.v3; format=json, github.machine-man-preview; format=json',
'x-github-request-id': 'DA17:447A:93639E1:1128EFAD:5BEDE1C8',
'x-ratelimit-limit': '30',
'x-ratelimit-remaining': '25',
'x-ratelimit-reset': '1542316508',
'x-xss-protection': '1; mode=block'
HttpError: "message":"Validation Failed","errors":["message":"The listed users and repositories cannot be searched either because the resources do not exist or you do not have permission to view them.","resource":"Search","field":"q","code":"invalid"],"documentation_url":"https://developer.github.com/v3/search/"
at response.text.then.message (/Users/me/git/issue-tracker/node_modules/@octokit/rest/lib/request/request.js:72:19)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
name: 'HttpError',
code: 422,
status: undefined,
headers:
'access-control-allow-origin': '*',
'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type',
'cache-control': 'no-cache',
connection: 'close',
'content-length': '306',
'content-security-policy': 'default-src 'none'',
'content-type': 'application/json; charset=utf-8',
date: 'Thu, 15 Nov 2018 21:14:49 GMT',
'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
server: 'GitHub.com',
status: '422 Unprocessable Entity',
'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
'x-content-type-options': 'nosniff',
'x-frame-options': 'deny',
'x-github-media-type': 'github.v3; format=json, github.machine-man-preview; format=json',
'x-github-request-id': 'DA18:447A:93639E4:1128EFB5:5BEDE1C8',
'x-ratelimit-limit': '30',
'x-ratelimit-remaining': '24',
'x-ratelimit-reset': '1542316508',
'x-xss-protection': '1; mode=block'
I'm a bit stumped with this one.
javascript node.js authentication github github-api
add a comment |
Some time ago I provided this answer to a question. the code sample is one which I've used in several applications without any issue.
Now, I'm trying to use it again but when I run it I get this error:
TypeError: Cannot read property 'access_tokens_url' of undefined
The access_tokens_url isn't in the response as you can see:
status: 200,
statusText: 'OK',
headers:
server: 'GitHub.com',
date: 'Tue, 13 Nov 2018 19:48:12 GMT',
'content-type': 'application/json; charset=utf-8',
'content-length': '2',
connection: 'close',
status: '200 OK',
'cache-control': 'public, max-age=60, s-maxage=60',
vary: 'Accept',
etag: '"5b49dc572fac1de90f6dcbe96af712d9"',
'x-github-media-type': 'github.machine-man-preview; format=json',
'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type',
'access-control-allow-origin': '*',
'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
'x-frame-options': 'deny',
'x-content-type-options': 'nosniff',
'x-xss-protection': '1; mode=block',
'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
'content-security-policy': 'default-src 'none'',
'x-github-request-id': 'F6A0:223A:3E7AF15:7F929C0:5BEB2A7B' ,
config:
adapter: [Function: httpAdapter],
transformRequest: '0': [Function: transformRequest] ,
transformResponse: '0': [Function: transformResponse] ,
timeout: 0,
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
validateStatus: [Function: validateStatus],
headers:
Accept: 'application/vnd.github.machine-man-preview+json',
Authorization: 'Bearer blablabla',
'User-Agent': 'axios/0.18.0' ,
method: 'get',
url: 'https://api.github.com/app/installations',
data: undefined ,
request:
ClientRequest
domain: null,
_events:
socket: [Function],
abort: [Function],
aborted: [Function],
error: [Function],
timeout: [Function],
prefinish: [Function: requestOnPrefinish] ,
_eventsCount: 6,
_maxListeners: undefined,
output: ,
outputEncodings: ,
outputCallbacks: ,
outputSize: 0,
writable: true,
_last: true,
upgrading: false,
chunkedEncoding: false,
shouldKeepAlive: false,
useChunkedEncodingByDefault: false,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: 0,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket:
TLSSocket
_tlsOptions: [Object],
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
_SNICallback: null,
servername: null,
npnProtocol: undefined,
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object],
_eventsCount: 9,
connecting: false,
_hadError: false,
_handle: null,
_parent: null,
_host: 'api.github.com',
_readableState: [Object],
readable: false,
domain: null,
_maxListeners: undefined,
_writableState: [Object],
writable: false,
allowHalfOpen: false,
_bytesDispatched: 626,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: null,
_requestCert: true,
_rejectUnauthorized: true,
parser: null,
_httpMessage: [Circular],
read: [Function],
_consuming: true,
_idleNext: null,
_idlePrev: null,
_idleTimeout: -1,
[Symbol(asyncId)]: 24,
[Symbol(bytesRead)]: 937 ,
connection:
TLSSocket
_tlsOptions: [Object],
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
_SNICallback: null,
servername: null,
npnProtocol: undefined,
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object],
_eventsCount: 9,
connecting: false,
_hadError: false,
_handle: null,
_parent: null,
_host: 'api.github.com',
_readableState: [Object],
readable: false,
domain: null,
_maxListeners: undefined,
_writableState: [Object],
writable: false,
allowHalfOpen: false,
_bytesDispatched: 626,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: null,
_requestCert: true,
_rejectUnauthorized: true,
parser: null,
_httpMessage: [Circular],
read: [Function],
_consuming: true,
_idleNext: null,
_idlePrev: null,
_idleTimeout: -1,
[Symbol(asyncId)]: 24,
[Symbol(bytesRead)]: 937 ,
_header: 'GET /app/installations HTTP/1.1rnAccept: application/vnd.github.machine-man-preview+jsonrnAuthorization: Bearer blablablarnUser-Agent: axios/0.18.0rnHost: api.github.comrnConnection: closernrn',
_onPendingData: [Function: noopPendingOutput],
agent:
Agent
domain: null,
_events: [Object],
_eventsCount: 1,
_maxListeners: undefined,
defaultPort: 443,
protocol: 'https:',
options: [Object],
requests: ,
sockets: [Object],
freeSockets: ,
keepAliveMsecs: 1000,
keepAlive: false,
maxSockets: Infinity,
maxFreeSockets: 256,
maxCachedSessions: 100,
_sessionCache: [Object] ,
socketPath: undefined,
timeout: undefined,
method: 'GET',
path: '/app/installations',
_ended: true,
res:
IncomingMessage
_readableState: [Object],
readable: false,
domain: null,
_events: [Object],
_eventsCount: 3,
_maxListeners: undefined,
socket: [Object],
connection: [Object],
httpVersionMajor: 1,
httpVersionMinor: 1,
httpVersion: '1.1',
complete: true,
headers: [Object],
rawHeaders: [Array],
trailers: ,
rawTrailers: ,
upgrade: false,
url: '',
method: null,
statusCode: 200,
statusMessage: 'OK',
client: [Object],
_consuming: true,
_dumped: false,
req: [Circular],
responseUrl: 'https://api.github.com/app/installations',
redirects: ,
read: [Function] ,
aborted: undefined,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
_redirectable:
Writable
_writableState: [Object],
writable: true,
domain: null,
_events: [Object],
_eventsCount: 2,
_maxListeners: undefined,
_options: [Object],
_redirectCount: 0,
_redirects: ,
_requestBodyLength: 0,
_requestBodyBuffers: ,
_onNativeResponse: [Function],
_currentRequest: [Circular],
_currentUrl: 'https://api.github.com/app/installations' ,
[Symbol(outHeadersKey)]:
accept: [Array],
authorization: [Array],
'user-agent': [Array],
host: [Array] ,
data:
I'm trying to spot if anything is different in my code but I can't see anything. Is it possible something has changed with the APII and if so, how can I resolve this issue?
Additional Info.
This curl command:
curl -i -H "Authorization: Bearer blablabla" -H "Accept: application/vnd.github.machine-man-preview+json" https://api.github.com/app/installations
should also return the data response but with it I get:
HTTP/1.1 200 OK
Server: GitHub.com
Date: Wed, 14 Nov 2018 20:43:04 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 5
Status: 200 OK
Cache-Control: public, max-age=60, s-maxage=60
Vary: Accept
ETag: "5b49dc572fac1de90f6dcbe96af712d9"
X-GitHub-Media-Type: github.machine-man-preview; format=json
Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type
Access-Control-Allow-Origin: *
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
X-Frame-Options: deny
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
Content-Security-Policy: default-src 'none'
X-GitHub-Request-Id: E867:223A:47CF7F2:924E87D:5BEC88D8
[
]
so I don't think it's my code.
As I see it there is either an option with GitHub or with the way I've configured the GitHub app. An ideas?
Additional Info 2
A possible step further! I noticed the GitHub ap wasn't installed so I've that done now. The issue I'm having now is that when I execut my program I get this:
Unable to authenticate
Additional Info 3
I regenerated my PEM key. Now I'm getting this:
HttpError: "message":"Validation Failed","errors":["message":"The listed users and repositories cannot be searched either because the resources do not exist or you do not have permission to view them.","resource":"Search","field":"q","code":"invalid"],"documentation_url":"https://developer.github.com/v3/search/"
at response.text.then.message (/Users/me/git/issue-tracker/node_modules/@octokit/rest/lib/request/request.js:72:19)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
name: 'HttpError',
code: 422,
status: undefined,
headers:
'access-control-allow-origin': '*',
'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type',
'cache-control': 'no-cache',
connection: 'close',
'content-length': '306',
'content-security-policy': 'default-src 'none'',
'content-type': 'application/json; charset=utf-8',
date: 'Thu, 15 Nov 2018 21:14:49 GMT',
'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
server: 'GitHub.com',
status: '422 Unprocessable Entity',
'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
'x-content-type-options': 'nosniff',
'x-frame-options': 'deny',
'x-github-media-type': 'github.v3; format=json, github.machine-man-preview; format=json',
'x-github-request-id': 'DA17:447A:93639E1:1128EFAD:5BEDE1C8',
'x-ratelimit-limit': '30',
'x-ratelimit-remaining': '25',
'x-ratelimit-reset': '1542316508',
'x-xss-protection': '1; mode=block'
HttpError: "message":"Validation Failed","errors":["message":"The listed users and repositories cannot be searched either because the resources do not exist or you do not have permission to view them.","resource":"Search","field":"q","code":"invalid"],"documentation_url":"https://developer.github.com/v3/search/"
at response.text.then.message (/Users/me/git/issue-tracker/node_modules/@octokit/rest/lib/request/request.js:72:19)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
name: 'HttpError',
code: 422,
status: undefined,
headers:
'access-control-allow-origin': '*',
'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type',
'cache-control': 'no-cache',
connection: 'close',
'content-length': '306',
'content-security-policy': 'default-src 'none'',
'content-type': 'application/json; charset=utf-8',
date: 'Thu, 15 Nov 2018 21:14:49 GMT',
'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
server: 'GitHub.com',
status: '422 Unprocessable Entity',
'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
'x-content-type-options': 'nosniff',
'x-frame-options': 'deny',
'x-github-media-type': 'github.v3; format=json, github.machine-man-preview; format=json',
'x-github-request-id': 'DA18:447A:93639E4:1128EFB5:5BEDE1C8',
'x-ratelimit-limit': '30',
'x-ratelimit-remaining': '24',
'x-ratelimit-reset': '1542316508',
'x-xss-protection': '1; mode=block'
I'm a bit stumped with this one.
javascript node.js authentication github github-api
add a comment |
Some time ago I provided this answer to a question. the code sample is one which I've used in several applications without any issue.
Now, I'm trying to use it again but when I run it I get this error:
TypeError: Cannot read property 'access_tokens_url' of undefined
The access_tokens_url isn't in the response as you can see:
status: 200,
statusText: 'OK',
headers:
server: 'GitHub.com',
date: 'Tue, 13 Nov 2018 19:48:12 GMT',
'content-type': 'application/json; charset=utf-8',
'content-length': '2',
connection: 'close',
status: '200 OK',
'cache-control': 'public, max-age=60, s-maxage=60',
vary: 'Accept',
etag: '"5b49dc572fac1de90f6dcbe96af712d9"',
'x-github-media-type': 'github.machine-man-preview; format=json',
'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type',
'access-control-allow-origin': '*',
'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
'x-frame-options': 'deny',
'x-content-type-options': 'nosniff',
'x-xss-protection': '1; mode=block',
'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
'content-security-policy': 'default-src 'none'',
'x-github-request-id': 'F6A0:223A:3E7AF15:7F929C0:5BEB2A7B' ,
config:
adapter: [Function: httpAdapter],
transformRequest: '0': [Function: transformRequest] ,
transformResponse: '0': [Function: transformResponse] ,
timeout: 0,
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
validateStatus: [Function: validateStatus],
headers:
Accept: 'application/vnd.github.machine-man-preview+json',
Authorization: 'Bearer blablabla',
'User-Agent': 'axios/0.18.0' ,
method: 'get',
url: 'https://api.github.com/app/installations',
data: undefined ,
request:
ClientRequest
domain: null,
_events:
socket: [Function],
abort: [Function],
aborted: [Function],
error: [Function],
timeout: [Function],
prefinish: [Function: requestOnPrefinish] ,
_eventsCount: 6,
_maxListeners: undefined,
output: ,
outputEncodings: ,
outputCallbacks: ,
outputSize: 0,
writable: true,
_last: true,
upgrading: false,
chunkedEncoding: false,
shouldKeepAlive: false,
useChunkedEncodingByDefault: false,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: 0,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket:
TLSSocket
_tlsOptions: [Object],
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
_SNICallback: null,
servername: null,
npnProtocol: undefined,
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object],
_eventsCount: 9,
connecting: false,
_hadError: false,
_handle: null,
_parent: null,
_host: 'api.github.com',
_readableState: [Object],
readable: false,
domain: null,
_maxListeners: undefined,
_writableState: [Object],
writable: false,
allowHalfOpen: false,
_bytesDispatched: 626,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: null,
_requestCert: true,
_rejectUnauthorized: true,
parser: null,
_httpMessage: [Circular],
read: [Function],
_consuming: true,
_idleNext: null,
_idlePrev: null,
_idleTimeout: -1,
[Symbol(asyncId)]: 24,
[Symbol(bytesRead)]: 937 ,
connection:
TLSSocket
_tlsOptions: [Object],
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
_SNICallback: null,
servername: null,
npnProtocol: undefined,
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object],
_eventsCount: 9,
connecting: false,
_hadError: false,
_handle: null,
_parent: null,
_host: 'api.github.com',
_readableState: [Object],
readable: false,
domain: null,
_maxListeners: undefined,
_writableState: [Object],
writable: false,
allowHalfOpen: false,
_bytesDispatched: 626,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: null,
_requestCert: true,
_rejectUnauthorized: true,
parser: null,
_httpMessage: [Circular],
read: [Function],
_consuming: true,
_idleNext: null,
_idlePrev: null,
_idleTimeout: -1,
[Symbol(asyncId)]: 24,
[Symbol(bytesRead)]: 937 ,
_header: 'GET /app/installations HTTP/1.1rnAccept: application/vnd.github.machine-man-preview+jsonrnAuthorization: Bearer blablablarnUser-Agent: axios/0.18.0rnHost: api.github.comrnConnection: closernrn',
_onPendingData: [Function: noopPendingOutput],
agent:
Agent
domain: null,
_events: [Object],
_eventsCount: 1,
_maxListeners: undefined,
defaultPort: 443,
protocol: 'https:',
options: [Object],
requests: ,
sockets: [Object],
freeSockets: ,
keepAliveMsecs: 1000,
keepAlive: false,
maxSockets: Infinity,
maxFreeSockets: 256,
maxCachedSessions: 100,
_sessionCache: [Object] ,
socketPath: undefined,
timeout: undefined,
method: 'GET',
path: '/app/installations',
_ended: true,
res:
IncomingMessage
_readableState: [Object],
readable: false,
domain: null,
_events: [Object],
_eventsCount: 3,
_maxListeners: undefined,
socket: [Object],
connection: [Object],
httpVersionMajor: 1,
httpVersionMinor: 1,
httpVersion: '1.1',
complete: true,
headers: [Object],
rawHeaders: [Array],
trailers: ,
rawTrailers: ,
upgrade: false,
url: '',
method: null,
statusCode: 200,
statusMessage: 'OK',
client: [Object],
_consuming: true,
_dumped: false,
req: [Circular],
responseUrl: 'https://api.github.com/app/installations',
redirects: ,
read: [Function] ,
aborted: undefined,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
_redirectable:
Writable
_writableState: [Object],
writable: true,
domain: null,
_events: [Object],
_eventsCount: 2,
_maxListeners: undefined,
_options: [Object],
_redirectCount: 0,
_redirects: ,
_requestBodyLength: 0,
_requestBodyBuffers: ,
_onNativeResponse: [Function],
_currentRequest: [Circular],
_currentUrl: 'https://api.github.com/app/installations' ,
[Symbol(outHeadersKey)]:
accept: [Array],
authorization: [Array],
'user-agent': [Array],
host: [Array] ,
data:
I'm trying to spot if anything is different in my code but I can't see anything. Is it possible something has changed with the APII and if so, how can I resolve this issue?
Additional Info.
This curl command:
curl -i -H "Authorization: Bearer blablabla" -H "Accept: application/vnd.github.machine-man-preview+json" https://api.github.com/app/installations
should also return the data response but with it I get:
HTTP/1.1 200 OK
Server: GitHub.com
Date: Wed, 14 Nov 2018 20:43:04 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 5
Status: 200 OK
Cache-Control: public, max-age=60, s-maxage=60
Vary: Accept
ETag: "5b49dc572fac1de90f6dcbe96af712d9"
X-GitHub-Media-Type: github.machine-man-preview; format=json
Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type
Access-Control-Allow-Origin: *
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
X-Frame-Options: deny
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
Content-Security-Policy: default-src 'none'
X-GitHub-Request-Id: E867:223A:47CF7F2:924E87D:5BEC88D8
[
]
so I don't think it's my code.
As I see it there is either an option with GitHub or with the way I've configured the GitHub app. An ideas?
Additional Info 2
A possible step further! I noticed the GitHub ap wasn't installed so I've that done now. The issue I'm having now is that when I execut my program I get this:
Unable to authenticate
Additional Info 3
I regenerated my PEM key. Now I'm getting this:
HttpError: "message":"Validation Failed","errors":["message":"The listed users and repositories cannot be searched either because the resources do not exist or you do not have permission to view them.","resource":"Search","field":"q","code":"invalid"],"documentation_url":"https://developer.github.com/v3/search/"
at response.text.then.message (/Users/me/git/issue-tracker/node_modules/@octokit/rest/lib/request/request.js:72:19)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
name: 'HttpError',
code: 422,
status: undefined,
headers:
'access-control-allow-origin': '*',
'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type',
'cache-control': 'no-cache',
connection: 'close',
'content-length': '306',
'content-security-policy': 'default-src 'none'',
'content-type': 'application/json; charset=utf-8',
date: 'Thu, 15 Nov 2018 21:14:49 GMT',
'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
server: 'GitHub.com',
status: '422 Unprocessable Entity',
'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
'x-content-type-options': 'nosniff',
'x-frame-options': 'deny',
'x-github-media-type': 'github.v3; format=json, github.machine-man-preview; format=json',
'x-github-request-id': 'DA17:447A:93639E1:1128EFAD:5BEDE1C8',
'x-ratelimit-limit': '30',
'x-ratelimit-remaining': '25',
'x-ratelimit-reset': '1542316508',
'x-xss-protection': '1; mode=block'
HttpError: "message":"Validation Failed","errors":["message":"The listed users and repositories cannot be searched either because the resources do not exist or you do not have permission to view them.","resource":"Search","field":"q","code":"invalid"],"documentation_url":"https://developer.github.com/v3/search/"
at response.text.then.message (/Users/me/git/issue-tracker/node_modules/@octokit/rest/lib/request/request.js:72:19)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
name: 'HttpError',
code: 422,
status: undefined,
headers:
'access-control-allow-origin': '*',
'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type',
'cache-control': 'no-cache',
connection: 'close',
'content-length': '306',
'content-security-policy': 'default-src 'none'',
'content-type': 'application/json; charset=utf-8',
date: 'Thu, 15 Nov 2018 21:14:49 GMT',
'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
server: 'GitHub.com',
status: '422 Unprocessable Entity',
'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
'x-content-type-options': 'nosniff',
'x-frame-options': 'deny',
'x-github-media-type': 'github.v3; format=json, github.machine-man-preview; format=json',
'x-github-request-id': 'DA18:447A:93639E4:1128EFB5:5BEDE1C8',
'x-ratelimit-limit': '30',
'x-ratelimit-remaining': '24',
'x-ratelimit-reset': '1542316508',
'x-xss-protection': '1; mode=block'
I'm a bit stumped with this one.
javascript node.js authentication github github-api
Some time ago I provided this answer to a question. the code sample is one which I've used in several applications without any issue.
Now, I'm trying to use it again but when I run it I get this error:
TypeError: Cannot read property 'access_tokens_url' of undefined
The access_tokens_url isn't in the response as you can see:
status: 200,
statusText: 'OK',
headers:
server: 'GitHub.com',
date: 'Tue, 13 Nov 2018 19:48:12 GMT',
'content-type': 'application/json; charset=utf-8',
'content-length': '2',
connection: 'close',
status: '200 OK',
'cache-control': 'public, max-age=60, s-maxage=60',
vary: 'Accept',
etag: '"5b49dc572fac1de90f6dcbe96af712d9"',
'x-github-media-type': 'github.machine-man-preview; format=json',
'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type',
'access-control-allow-origin': '*',
'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
'x-frame-options': 'deny',
'x-content-type-options': 'nosniff',
'x-xss-protection': '1; mode=block',
'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
'content-security-policy': 'default-src 'none'',
'x-github-request-id': 'F6A0:223A:3E7AF15:7F929C0:5BEB2A7B' ,
config:
adapter: [Function: httpAdapter],
transformRequest: '0': [Function: transformRequest] ,
transformResponse: '0': [Function: transformResponse] ,
timeout: 0,
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
validateStatus: [Function: validateStatus],
headers:
Accept: 'application/vnd.github.machine-man-preview+json',
Authorization: 'Bearer blablabla',
'User-Agent': 'axios/0.18.0' ,
method: 'get',
url: 'https://api.github.com/app/installations',
data: undefined ,
request:
ClientRequest
domain: null,
_events:
socket: [Function],
abort: [Function],
aborted: [Function],
error: [Function],
timeout: [Function],
prefinish: [Function: requestOnPrefinish] ,
_eventsCount: 6,
_maxListeners: undefined,
output: ,
outputEncodings: ,
outputCallbacks: ,
outputSize: 0,
writable: true,
_last: true,
upgrading: false,
chunkedEncoding: false,
shouldKeepAlive: false,
useChunkedEncodingByDefault: false,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: 0,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket:
TLSSocket
_tlsOptions: [Object],
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
_SNICallback: null,
servername: null,
npnProtocol: undefined,
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object],
_eventsCount: 9,
connecting: false,
_hadError: false,
_handle: null,
_parent: null,
_host: 'api.github.com',
_readableState: [Object],
readable: false,
domain: null,
_maxListeners: undefined,
_writableState: [Object],
writable: false,
allowHalfOpen: false,
_bytesDispatched: 626,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: null,
_requestCert: true,
_rejectUnauthorized: true,
parser: null,
_httpMessage: [Circular],
read: [Function],
_consuming: true,
_idleNext: null,
_idlePrev: null,
_idleTimeout: -1,
[Symbol(asyncId)]: 24,
[Symbol(bytesRead)]: 937 ,
connection:
TLSSocket
_tlsOptions: [Object],
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
_SNICallback: null,
servername: null,
npnProtocol: undefined,
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object],
_eventsCount: 9,
connecting: false,
_hadError: false,
_handle: null,
_parent: null,
_host: 'api.github.com',
_readableState: [Object],
readable: false,
domain: null,
_maxListeners: undefined,
_writableState: [Object],
writable: false,
allowHalfOpen: false,
_bytesDispatched: 626,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: null,
_requestCert: true,
_rejectUnauthorized: true,
parser: null,
_httpMessage: [Circular],
read: [Function],
_consuming: true,
_idleNext: null,
_idlePrev: null,
_idleTimeout: -1,
[Symbol(asyncId)]: 24,
[Symbol(bytesRead)]: 937 ,
_header: 'GET /app/installations HTTP/1.1rnAccept: application/vnd.github.machine-man-preview+jsonrnAuthorization: Bearer blablablarnUser-Agent: axios/0.18.0rnHost: api.github.comrnConnection: closernrn',
_onPendingData: [Function: noopPendingOutput],
agent:
Agent
domain: null,
_events: [Object],
_eventsCount: 1,
_maxListeners: undefined,
defaultPort: 443,
protocol: 'https:',
options: [Object],
requests: ,
sockets: [Object],
freeSockets: ,
keepAliveMsecs: 1000,
keepAlive: false,
maxSockets: Infinity,
maxFreeSockets: 256,
maxCachedSessions: 100,
_sessionCache: [Object] ,
socketPath: undefined,
timeout: undefined,
method: 'GET',
path: '/app/installations',
_ended: true,
res:
IncomingMessage
_readableState: [Object],
readable: false,
domain: null,
_events: [Object],
_eventsCount: 3,
_maxListeners: undefined,
socket: [Object],
connection: [Object],
httpVersionMajor: 1,
httpVersionMinor: 1,
httpVersion: '1.1',
complete: true,
headers: [Object],
rawHeaders: [Array],
trailers: ,
rawTrailers: ,
upgrade: false,
url: '',
method: null,
statusCode: 200,
statusMessage: 'OK',
client: [Object],
_consuming: true,
_dumped: false,
req: [Circular],
responseUrl: 'https://api.github.com/app/installations',
redirects: ,
read: [Function] ,
aborted: undefined,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
_redirectable:
Writable
_writableState: [Object],
writable: true,
domain: null,
_events: [Object],
_eventsCount: 2,
_maxListeners: undefined,
_options: [Object],
_redirectCount: 0,
_redirects: ,
_requestBodyLength: 0,
_requestBodyBuffers: ,
_onNativeResponse: [Function],
_currentRequest: [Circular],
_currentUrl: 'https://api.github.com/app/installations' ,
[Symbol(outHeadersKey)]:
accept: [Array],
authorization: [Array],
'user-agent': [Array],
host: [Array] ,
data:
I'm trying to spot if anything is different in my code but I can't see anything. Is it possible something has changed with the APII and if so, how can I resolve this issue?
Additional Info.
This curl command:
curl -i -H "Authorization: Bearer blablabla" -H "Accept: application/vnd.github.machine-man-preview+json" https://api.github.com/app/installations
should also return the data response but with it I get:
HTTP/1.1 200 OK
Server: GitHub.com
Date: Wed, 14 Nov 2018 20:43:04 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 5
Status: 200 OK
Cache-Control: public, max-age=60, s-maxage=60
Vary: Accept
ETag: "5b49dc572fac1de90f6dcbe96af712d9"
X-GitHub-Media-Type: github.machine-man-preview; format=json
Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type
Access-Control-Allow-Origin: *
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
X-Frame-Options: deny
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
Content-Security-Policy: default-src 'none'
X-GitHub-Request-Id: E867:223A:47CF7F2:924E87D:5BEC88D8
[
]
so I don't think it's my code.
As I see it there is either an option with GitHub or with the way I've configured the GitHub app. An ideas?
Additional Info 2
A possible step further! I noticed the GitHub ap wasn't installed so I've that done now. The issue I'm having now is that when I execut my program I get this:
Unable to authenticate
Additional Info 3
I regenerated my PEM key. Now I'm getting this:
HttpError: "message":"Validation Failed","errors":["message":"The listed users and repositories cannot be searched either because the resources do not exist or you do not have permission to view them.","resource":"Search","field":"q","code":"invalid"],"documentation_url":"https://developer.github.com/v3/search/"
at response.text.then.message (/Users/me/git/issue-tracker/node_modules/@octokit/rest/lib/request/request.js:72:19)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
name: 'HttpError',
code: 422,
status: undefined,
headers:
'access-control-allow-origin': '*',
'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type',
'cache-control': 'no-cache',
connection: 'close',
'content-length': '306',
'content-security-policy': 'default-src 'none'',
'content-type': 'application/json; charset=utf-8',
date: 'Thu, 15 Nov 2018 21:14:49 GMT',
'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
server: 'GitHub.com',
status: '422 Unprocessable Entity',
'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
'x-content-type-options': 'nosniff',
'x-frame-options': 'deny',
'x-github-media-type': 'github.v3; format=json, github.machine-man-preview; format=json',
'x-github-request-id': 'DA17:447A:93639E1:1128EFAD:5BEDE1C8',
'x-ratelimit-limit': '30',
'x-ratelimit-remaining': '25',
'x-ratelimit-reset': '1542316508',
'x-xss-protection': '1; mode=block'
HttpError: "message":"Validation Failed","errors":["message":"The listed users and repositories cannot be searched either because the resources do not exist or you do not have permission to view them.","resource":"Search","field":"q","code":"invalid"],"documentation_url":"https://developer.github.com/v3/search/"
at response.text.then.message (/Users/me/git/issue-tracker/node_modules/@octokit/rest/lib/request/request.js:72:19)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
name: 'HttpError',
code: 422,
status: undefined,
headers:
'access-control-allow-origin': '*',
'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type',
'cache-control': 'no-cache',
connection: 'close',
'content-length': '306',
'content-security-policy': 'default-src 'none'',
'content-type': 'application/json; charset=utf-8',
date: 'Thu, 15 Nov 2018 21:14:49 GMT',
'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
server: 'GitHub.com',
status: '422 Unprocessable Entity',
'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
'x-content-type-options': 'nosniff',
'x-frame-options': 'deny',
'x-github-media-type': 'github.v3; format=json, github.machine-man-preview; format=json',
'x-github-request-id': 'DA18:447A:93639E4:1128EFB5:5BEDE1C8',
'x-ratelimit-limit': '30',
'x-ratelimit-remaining': '24',
'x-ratelimit-reset': '1542316508',
'x-xss-protection': '1; mode=block'
I'm a bit stumped with this one.
javascript node.js authentication github github-api
javascript node.js authentication github github-api
edited Nov 15 '18 at 21:22
runnerpaul
asked Nov 13 '18 at 20:19
runnerpaulrunnerpaul
644424
644424
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
The issue here was that a key in one of the parameters I was passing had a typo.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53288880%2fcode-that-once-returned-git-installation-access-token-no-longer-does-so%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The issue here was that a key in one of the parameters I was passing had a typo.
add a comment |
The issue here was that a key in one of the parameters I was passing had a typo.
add a comment |
The issue here was that a key in one of the parameters I was passing had a typo.
The issue here was that a key in one of the parameters I was passing had a typo.
answered Nov 16 '18 at 15:19
runnerpaulrunnerpaul
644424
644424
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53288880%2fcode-that-once-returned-git-installation-access-token-no-longer-does-so%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown