-
-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Creating a repo on User's account using #64
Comments
Hmm it's possible that installations cannot create repositories for users.
The way to get a user-to-server token is to redirect the user to an OAuth flow. In your GitHub App's settings, set the callback URL and the " Request user authorization (OAuth) during installation" checkbox. If you use the https://github.com/octokit/octokit.js?tab=readme-ov-file#oauth The |
Hey, thank you for the reply. So in my project, the whole purpose of creating a GitHub App and installing it in user's account was to create the private template repo on user's account. I have a GitHub oauth flow as well. Basically first, I authenticate user with GitHub oauth and once they are logged in, I provide link which will direct users to install my GitHub App. export default oauth.githubEventHandler({
config: {
scope: ["repo", "user", "workflow"],
},
async onSuccess(event, { user, tokens }) {
console.log(tokens)
const appLink = `https://github.com/apps/${githubApp}/installations/new/permissions?target_id=${user.id}`
await setUserSession(event, {
loggedInAt: new Date().toISOString(),
user: {
email: user.email,
providerId: user.id,
name: user.name,
appLink,
},
})
return sendRedirect(event, "/profile") Please ignore the messy code 😅 I get |
I don't know out of hand, I'd need to investigate this further myself and I don't have the time to do so right now, I'm sorry. If you find a way, can you share it please? It's a very interesting use case |
Well, i just got a response back from Github support and looks like there is no way we can archive that. Thank you for your time ✌🏻 |
Sorry to hear that |
Please avoid duplicates
Description
Body
I have created a GitHub App and added following scopes:
Then I created a sample user to test out my own GitHub App. I installed my own GitHub App using my newly created User and authorized to act on behalf of this user, however whenever I try to create a repo on this user's account using my GitHub App I get
Here is the code I use:
P.S: I made a research and found this Github Token Forms. And in here it says we need
user-to-server
token which isghu_${token}
but the token I get here:this is
ghs: server-to-server tokens
. When I make request using this token:I get
Question
Do I still need to get
ghu_${token} user-to-server
to create a repo using my GitHub App on behalf of the user ? And if so how can I get it ?P.S: I need to get it done asap, I would really appreciate if you can help, Thanks in advance!
Would you be interested in joining the show?
The text was updated successfully, but these errors were encountered: