Fireship · @fireship

Coinbase + Firebase - Build a Bitcoin App

Uploaded December 17, 2017 · Length 10:39

Coinbase + Firebase - Build a Bitcoin App

Summary

build a bitcoin app using coinbase and firebase for custom authentication and transactions

  • coinbase firebase integration
  • bitcoin app development
  • custom authentication
  • firebase authentication
  • angular firebase app
  • coinbase api

Transcript preview

The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.

  1. 0:00

    it might be a little late to get in on

  2. 0:01

    the Bitcoin bubble but it's not too late

  3. 0:03

    to start building apps for people that

  4. 0:05

    use crypto currencies in this episode

  5. 0:07

    I'm going to show you how to use coin

  6. 0:08

    base as a custom authentication provider

  7. 0:10

    for firebase that means your users will

  8. 0:13

    be able to log in to firebase via

  9. 0:14

    coinbase and then you can use the coin

  10. 0:16

    base API to handle Bitcoin transactions

  11. 0:19

    if you're new here make sure to

  12. 0:20

    subscribe and you can follow along with

  13. 0:22

    the source code at angular firebase com

  14. 0:24

    let's first take a look at how this is

  15. 0:25

    going to work the user is going to click

  16. 0:27

    the log in with coinbase button in our

  17. 0:29

    angular app that redirects then the coin

  18. 0:31

    base where they authenticate into their

  19. 0:32

    account then coinbase redirects them

  20. 0:34

    back to angular with an encrypted off

  21. 0:36

    code the code then goes to a cloud

  22. 0:38

    function which exchanges it for an

  23. 0:39

    actual access token and refresh token

  24. 0:42

    from coinbase we can then mint our own

  25. 0:44

    custom firebase authentication token

  26. 0:46

    then send it back to angular and log the

  27. 0:48

    user in as a firebase user learning this

  28. 0:51

    process will also allow you to

  29. 0:52

    authenticate with other providers such

  30. 0:54

    as Instagram Twitter pata Phi and many

  31. 0:57

    others to get started you'll need a coin

  32. 0:59

    base account and you'll want to create a

  33. 1:01

    new o2 application make note of your API

  34. 1:04

    keys and then make sure you set a

  35. 1:06

    redirect URI that points to localhost

  36. 1:08

    4200 slash redirect after that you can

  37. 1:11

    create a brand new angular 5 app and

  38. 1:13

    make sure it has the routing module from

  39. 1:15

    there you'll need to install angularfire

  40. 1:17

    2 and firebase so make sure to follow

  41. 1:19

    the official instructions at the

  42. 1:21

    angularfire repo now inside of our

  43. 1:23

    angular project we're going to

  44. 1:25

    initialize cloud functions we're also

  45. 1:27

    going to use the new typescript option

  46. 1:28

    so make sure your firebase CLI tools are

  47. 1:31

    updated to the latest version I also

  48. 1:34

    have a few dependencies in the cloud

  49. 1:35

    function environment the main one is

  50. 1:37

    Axios which replaces the node HTTP

  51. 1:40

    module the reason we do that is because

  52. 1:42

    promises are a lot easier to work with

  53. 1:43

    and callbacks when dealing with

  54. 1:45

    asynchronous activity and a cloud

  55. 1:47

    function then I also have cores and

  56. 1:50

    crypto which we'll see in use here in

  57. 1:51

    just a second because we're going to be

  58. 1:54

    minting custom off tokens we need to use

  59. 1:56

    our actual service account from firebase

  60. 1:58

    it's just a JSON file and I'll quickly