Fireship · @fireship

Ionic Google Login for iOS and Android

Uploaded February 23, 2018 · Length 7:20

Ionic Google Login for iOS and Android

Summary

Implement Google OAuth login in Ionic for iOS and Android apps, including progressive web apps, using Cordova plug-in and Firebase.

  • ionic google login
  • firebase oauth
  • cordova plugin
  • google login ios
  • google login android
  • progressive web app login

Transcript preview

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

  1. 0:00

    [Music]

  2. 0:01

    fire base makes Google OAuth extremely

  3. 0:04

    easy and web apps but if we're building

  4. 0:06

    a native mobile app with ionic there are

  5. 0:08

    some additional considerations we need

  6. 0:10

    to think about for iOS and Android when

  7. 0:13

    logging in we can't just use a regular

  8. 0:14

    browser popup window or URL redirect

  9. 0:17

    like we would in a web app instead we

  10. 0:19

    use a Cordova plug-in to access features

  11. 0:21

    that are only available on the native

  12. 0:22

    mobile device in this video I'm going to

  13. 0:25

    show you how to implement Google OAuth

  14. 0:26

    from scratch in a way that works for iOS

  15. 0:29

    and Android

  16. 0:29

    as well as progressive web apps if

  17. 0:32

    you're new here make sure to subscribe

  18. 0:33

    and you can follow along with the source

  19. 0:35

    code at angular firebase com I am

  20. 0:38

    starting out from a brand new ionic app

  21. 0:39

    and setting a custom ID that we can use

  22. 0:41

    to register our app with iOS and Android

  23. 0:44

    on the firebase console your ID should

  24. 0:47

    follow a format of com dot brand name

  25. 0:50

    dot project name just to give you a

  26. 0:52

    heads up this episode's going to have a

  27. 0:53

    lot of long commands like this but you

  28. 0:55

    can copy and paste all of them from the

  29. 0:57

    main write up the next thing we'll do is

  30. 0:59

    install firebase and angular fire 2 into

  31. 1:02

    our project and lastly we'll need a

  32. 1:04

    component in ionic for our Google login

  33. 1:07

    feature if we jump into our app at this

  34. 1:09

    point we should be able to go into the

  35. 1:11

    config.xml file and you should see your

  36. 1:13

    project ID that you set from the command

  37. 1:15

    line as the widget ID but if starting

  38. 1:17

    from an existing app go ahead and update

  39. 1:19

    the default ID to whatever your project

  40. 1:21

    ID happens to be now we can set up our

  41. 1:24

    mobile apps in firebase so you'll go

  42. 1:26

    ahead and add an app to your project and

  43. 1:28

    we'll start with the iOS configuration

  44. 1:31

    all you have to do is enter your project

  45. 1:33

    ID and then go through the steps you

  46. 1:36

    don't need to do anything else other

  47. 1:37

    than register your app with this ID that

  48. 1:40

    takes care of iOS for Android we have an

  49. 1:43

    additional step for local development

  50. 1:45

    we'll start by entering the same project

  51. 1:47

    ID like we just did but we also need the

  52. 1:50

    debug signing certificate to enable

  53. 1:52

    Google+ from our local development

  54. 1:54

    environment you can obtain the

  55. 1:56

    certificate from the command-line and

  56. 1:57

    you'll need one for every machine that

  57. 1:59

    you use in the development of this app