I am using NextAuth and Github to authenticate a user in my app. I am trying to run a TRPC query to return an authenticated user's github repo information.
const response = await fetch(`https://api.github.com/user`, {
headers: {'Authorization': `Bearer ${account?.access_token}`,}
});
- The
access_token
is available - it logs out - The
access_token
is provided by NextAuth - Error Message:
documentation_url: "https://docs.github.com/rest" message: "Bad credentials"
I am not sure exactly what I am doing wrong. When the user authenticates into my APP, I make sure to use user
scope - and this is reflected under the account.scope
property and Github Authentication UI.
I would appreciate some help, thank you !