Skip to content

123pzy/vue3-koa-github-oauth2-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

1.克隆代码:

git clone https://github.com/123pzy/vue3-koa-github-oauth2-demo.git

cd vue3-koa-github-oauth2-demo

2.分别给前后端安装包并启动:

  • cd web pnpm i pnpm run dev
  • cd server pnpm i node app.js

3.点击这里去GitHub登记一个应用:

image-20240423123037288

4.点击生成密钥:

5.替换前端代码中Index.vue中的client_id为自己的Client ID

替换后端代码中app.js文件中的clientID为自己的Client ID,替换clientSecret为自己的Client secrets

6.打开http://localhost:5173,

点击登录GitHub

image-20240423123308235 跳转到授权页面:

确认授权后网络没问题的话(能访问github)的话,跳转到http://localhost:5173/oauth/redirect?code=...

授权(登录)成功!⬇

About

vue3+koa实现网站的GitHub第三方登录demo

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published