首页 > 编程知识 正文

在你的计算机上使用qr码登录,springboot微信点餐系统

时间:2023-05-04 20:04:42 阅读:152897 作者:3212

集成JustAuth开源组件实现微信登录。

文档地址: https://just auth.wiki/oauth/we chat _ open.html

1、新建Spring Boot项目2、dependencygroupidorg.spring framework.boot/groupidartifactidspring-boot-starter-web/部署artification的ependencydependencygroupidorg.project lombok/groupidartifactidlombok/artifact id/dependencydependencygroupidme.zhyd.project groupidartifactidjustauth/artifactidversion1. 16.3/version/dependencyden groupidartifactiding artifactidversion5.7.7/version/dependencydependencygroupidcom.square up.ok http3/groupidartifartion

server.port=8160 5、启动程序6、contorllerpackagecom.yanghui.oauth.controller; import me.zhyd.oauth.config.authconfig; import me.zhyd.oauth.model.auth callback; import me.zhyd.oauth.request.auth request; import me.zhyd.oauth.request.authwechatopenrequest; import me.zhyd.oauth.utils.authstateutils; importorg.spring framework.web.bind.annotation.request mapping; importorg.spring framework.web.bind.annotation.rest controller; import javax.servlet.http.http无servlet轮询; import java.io.IOException; /** *微信扫码注册* @ classnamerestauthcontroller * @ author yh * @ date 2021/9/19 * @ version 1.0 */@ rest controller privatestringappsecret=' a 7482517235173 DDB 4083788 de 60 b 90 e '; /**回调目标的dddddd/privatestring redirecturl=' http://localhost 33608160/API/UC enter/wx/callback '; @requestmapping(/render ) ) publicvoidrenderauth ) httpservletresponseresponse ) throwsioException ) authrequestauthrequesption }@requestmapping((/callback ) (publicobjectlogin ) authcallbackcallback ) (authrequestauthrequest=getauthrequest ) ) returnauthrequest.log in (callback ); } privateauthrequestgetauthrequest ((returnnewauthwechatopenrequest ) authconfig.builder ).clientid ).clientid

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。