V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
• 请不要在回答技术问题时复制粘贴 AI 生成的内容
north521
V2EX  ›  程序员

大家准备摸鱼之际,咨询 oauth 的问题

  •  
  •   north521 · Oct 18, 2019 · 1358 views
    This topic created in 2387 days ago, the information mentioned may be changed or developed.

    自己有个网站 a,使用了 github 的 oauth 现在能拿到 access_token 了 问题来了,我的 a 网站如何控制用户的登录呢? 我提供了一个 restful 接口 需要用户登录之后才能访问 那么我能想到的是在后端,判断用户的 token 是否在 redis 中 不存在则返回 401

    但是感觉还是很模糊的,自己 a 网站的 token 直接用 github 的 token 总觉得怪

    1 replies    2019-10-18 19:10:31 +08:00
    tachikomachann
        1
    tachikomachann  
       Oct 18, 2019 via Android
    如果只是拿来登录,在 OAuth 流程走完,拿到 token 以后,就没有 git hub 的事了。
    登录后的会话管理是你自己网站 a 要做的事。OAuth 在这里的作用只是将网站 a 的帐号和 GitHub 账号关联在一起。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2449 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 03:37 · PVG 11:37 · LAX 20:37 · JFK 23:37
    ♥ Do have faith in what you're doing.