Code Monkey home page Code Monkey logo

apollozhu.github.io's Introduction

所有文章均采用 知识共享 署名-非商业性使用-相同方式共享 4.0 国际(CC BY-NC-SA 4.0)许可协议。

LICENSE, Code ONLY

Source code for Apollo's blog.
Copyright (C) 2016-2018  Apollo | Zhiyu Zhu | 朱智语 <[email protected]>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

apollozhu.github.io's People

Contributors

apollozhu avatar dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar renovate-bot avatar renovate[bot] avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

apollozhu.github.io's Issues

raywenderlich OAuth 学习笔记

目的

  • 通过 token,而不是用户名和密码实现用户身份验证
  • 可以限制能够访问得到的数据的范围来提升安全性

方法

  • 流程:用户登录第三方网站,输入用户名密码,第三方返回 token
  • 实现:使用 OAuth Swift 框架(做了很好的抽象

例子:Strava

从第三方注册 app,获取信息

image

使用 OAuth Swift:

image

配置 Deep Link 回 App:

image

打开 App 时完成验证,关闭 web view

image

把 access token 传入请求的 authorization header 里:

image

扩展阅读

  • User defaults 不是存储 token 的好地方,应该使用 keychain,没有找视频教程,可以看文章
  • OAuth 服务端的实现参考 https://docs.vapor.codes/3.0/auth/api/
    • 不要存储明文密码到数据库
    • Ray 其他的 vapor 视频里提到了 Turnstile,有兴趣可以仔细研究什么情况
  • bilibili 现在使用的是 session 式的用户认证(随 cookie 发送用户当前 session 信息)

参考资料

OAuth2: https://www.raywenderlich.com/5034-accessing-data-using-oauth

Images

<img src="here" />
You can safely Unsubscribe this Issue

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: Preset name not found within published preset config (monorepo:angularmaterial). Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.