Help with using accessToken in Octokit #1705
-
Hey everyone I added the Github access token to my session with the following code: callbacks: {
async jwt(token, user, account, profile, isNewUser) {
// Add access_token to the token right after signin
if (account?.accessToken) {
token.accessToken = account.accessToken
token.username = profile.login
}
return token
},
async session(session, token) {
// Add property to session, like an access_token from a provider.
session.accessToken = token.accessToken
session.user.username = token.username
return session
},
}, But now whenever I try to use the octokit for an authorized API call I get a 404. Example code: const session = await getSession({ req });
const octokit = new Octokit({
auth: session.accessToken
});
const { data } = await octokit.request("GET /orgs/{org}/issues", {
org: 'private-repo-here',
filter: 'assigned',
state: 'open',
}); Has anyone had a similar issue ? I tried a lot of combinations but I cant get it to work. Thanks |
Beta Was this translation helpful? Give feedback.
Answered by
balazsorban44
Apr 12, 2021
Replies: 1 comment 6 replies
-
404 means you are request a resource from a wrong url. I'm not familiar with octokit, but try to re-verify if you are using the correct url again. sorry if that is obvious, I don't have a better suggestion at the moment |
Beta Was this translation helpful? Give feedback.
6 replies
Answer selected by
lokmanm
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
404 means you are request a resource from a wrong url. I'm not familiar with octokit, but try to re-verify if you are using the correct url again. sorry if that is obvious, I don't have a better suggestion at the moment