Untitled

1. Github에 내 앱 등록(Register a new OAuth application)

Untitled

  1. Application Name : 내 앱 이름
  2. Homepage URL : 내 앱 주소 (ex. http://localhost:3000)
  3. Application description : 내 앱 설명
  4. Authorization callback URL : OAuth 인증 과정이 끝난 후 redirect 될 주소 (ex.http://localhost:3000/callback)

2. Github Login 시키기

Identifying and authorizing users for GitHub Apps - GitHub Docs

this.GITHUB_LOGIN_URL = '<https://github.com/login/oauth/authorize?client_id=ee33270fac53d2e7b61c>'
/* <https://github.com/login/oauth/authorize?client_id=본인의clientid&선택사항&redirect_uri=본인의redircet주소> */

import React from 'react';
import styled from 'styled-components';

const LoginBtn = () => {
  const loginUri = `https://github.com/login/oauth/authorize?client_id=본인의cliendid&scope=repo:status read:repo_hook user:email&redirect_uri=http://localhost:3000/callback`;

  return (
    <>
      <GithubBtn href={loginUri}></GithubBtn>
    </>
  );
};

const GithubBtn = styled.a`
//생략
`;

export default LoginBtn;

3. AutorizationCode & access token 발급