leoho0722
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee
  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    ###### tags: `第13屆IT邦鐵人賽文章` # 【在 iOS 開發路上的大小事-Day14】Firebase 的登入驗證服務介紹 # 前情提要 在前一篇有提到說,Firebase 有提供許多服務供開發者使用 登入驗證服務算是蠻常會被使用的服務之一,所以這篇就來介紹一下,到底有提供哪些登入方法吧 ![](https://i.imgur.com/ye4wtPK.png) ▲ Firebase 提供的所有登入驗證方式 # 進入正題 ## Email 登入 顧名思義就是透過 Email 和密碼來登入,也是最常見的登入方式之一 Firebase 提供了電子信箱驗證、忘記密碼/密碼重設、刪除帳號等功能 ## 電信業者登入 電信業者登入也就是透過電話號碼登入,實際運作的話大致就像下圖那樣 (有錯請告知,感謝!) ![](https://i.imgur.com/25VyZIS.png) 1. 使用者在 App 內選擇使用電話號碼進行驗證後,透過 Firebase Auth SDK 進行驗證 2. Firebase Auth 與 APNs 之間進行溝通,確認是否已有 APNs 憑證在 Firebase 內 3. APNs 憑證已在 Firebase 內後,透過遠端推播將驗證碼傳送至在 App 內填寫的電話號碼 4. 使用者在手機上收到驗證碼後,在 App 內輸入驗證碼以進行登入 >雖然用電話號碼驗證很方便,但與其他登入驗證相比,安全性較低,所以如果想要在 App 中使用電話號碼登入驗證的話,建議同時也要提供其他更安全的登入方式,並將使用電話號碼登入的安全問題告訴使用者 (引自 Firebase Auth 電話號碼驗證官方文件) ## Google 帳號登入 顧名思義就是透過 Google 帳號來登入,也是最常見的登入方式之一 [Google Developers 官方文件](https://developers.google.com/identity/sign-in/ios/start-integrating) ## Google Play 遊戲登入 (Android 才可以使用) >您可以使用 Google Play 遊戲服務,讓玩家登入在 Firebase 上構建的 Android 遊戲。要使用 Google Play 遊戲服務登入 Firebase,請首先讓玩家登入 Google Play 遊戲,並同時申請一個 OAuth 2.0 身份驗證代碼。然後,將此身份驗證代碼傳遞給 PlayGamesAuthProvider 以生成一個 Firebase 憑證,您可以使用該憑證進行 Firebase 身份驗證。 >(引自 Firebase Auth Google Play 遊戲服務官方文件) ## Game Center 登入 (Apple 裝置才可以使用) >您可以使用 Game Center,使玩家能夠登入用 Firebase 構建的 iOS 遊戲。要在 Firebase 上使用 Game Center 登入服務,請首先確保本地玩家已登入 Game Center,然後使用 GameCenterAuthProvider 生成一個 Firebase 憑證,您可以使用該憑證進行 Firebase 身份驗證。(引自 Firebase Auth Game Center 登入驗證官方文件) ## Facebook 帳號登入 顧名思義就是透過 Facebook 帳號來登入,也是最常見的登入方式之一 [Facebook Developers 官方文件](https://developers.facebook.com/docs/facebook-login/ios?sdk=cocoapods) ## Twitter 登入 顧名思義就是透過 Twitter 帳號來登入,也是最常見的登入方式之一 ## GitHub 登入 顧名思義就是透過 GitHub 帳號來登入,但不太常見 通常會在偏開發者的論壇出現 (例:Stack Overflow) ## Yahoo 帳號登入 顧名思義就是透過 Yahoo 帳號來登入,但隨著 Yahoo 慢慢被淘汰,所以也不建議使用 ## Microsoft 微軟帳號登入 顧名思義就是透過 Microsoft 微軟帳號來登入 但我印象中沒看過有 App 用過 (除了微軟自家的) [Microsoft Azure Directory 官網介紹](https://docs.microsoft.com/zh-tw/azure/active-directory/develop/quickstart-register-app) ## 使用 Apple ID 登入 (Sign in with Apple) 顧名思義就是透過 Apple ID 來登入,也是現在 iOS App 最常見的登入方式之一 (但不限於只在 iOS App 上可以使用,像是 Android、Web 都是可以使用的) 要注意的是,如果在 App 裡有使用到第三方驗證的話,像是 Google、Facebook 帳號登入的話 就必須一定要將 **使用 Apple ID 登入 (Sign in with Apple)** 這個登入方式也新增上去 不然日後如果要將 App 上架到 App Store 的話,可是會上架失敗,被 Apple 退回去的! 此外,要使用這項功能的話,必須要是 **Apple 付費開發者 (不包含企業帳號)** 才行喔~ [Apple Developer 官網介紹](https://developer.apple.com/sign-in-with-apple/) ## 匿名登入 >您可以用 Firebase Authentication 創建和使用臨時匿名帳號來進行 Firebase 身份驗證。借助臨時匿名帳號,尚未註冊您應用的用戶也可以使用受安全規則保護的數據。如果匿名用戶決定註冊您的應用,您可以將他們的登入憑證與匿名帳號關聯,這樣他們就可以在以後的操作中繼續使用其受保護的資料。(引自 Firebase Auth 匿名帳號登入官方文件) # 總結 今天分享了 Firebase 提供的所有帳號驗證方式,後面幾篇會來分享如何透過 Firebase 來使用 Email、Google 帳號、Facebook 帳號、Apple ID 這四種登入方式 參考資料: 1. [Firebase Auth 官方文件](https://firebase.google.com/docs/auth?authuser)

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully