import { nanoid } from 'nanoid';
import { useEffect, useState } from 'react';

const getGithubAuth = () => {
  const client_id = 'Ov23littcejmbA5iKrhK';
  const redirect_uri = 'https://envision.xiongxiao.me/github/callback';
  const scope = 'user';
  const state = 'abc123'; //&& nanoid(6);
  return `https://github.com/login/oauth/authorize?client_id=${client_id}&redirect_uri=${redirect_uri}&scope=${scope}&state=${state}`;
};
export const Login = () => {
  const [url, setUrl] = useState('');
  useEffect(() => {
    setUrl(getGithubAuth());
  }, []);
  return (
    <div>
      <a href={url}>Github登录</a>
    </div>
  );
};
