PixelogicDev / Gruvee-Mobile

#WeAreGrüvee
MIT License
48 stars 11 forks source link

[Release-1.0] Setup Authentication With Apple #61

Closed adilanchian closed 4 years ago

adilanchian commented 4 years ago

We currently have Spotify authentication setup and now need Apple. This is required by Apple currently. We also would like to user Apple Music for creating playlists and things of that nature. The current issue with this is there is no "straight forward" way to do this in React Native. We will need to implement some NativeModules to get this thing work. Currently this task should include:

adilanchian commented 4 years ago

What We Did Today

What We Will Do Next Time

adilanchian commented 4 years ago

What We Did Today

What We Will Do Tomorrow

adilanchian commented 4 years ago

Screen Shot 2020-04-28 at 7 31 17 AM

adilanchian commented 4 years ago

What We Did Today

What We Will Do Tomorrow

adilanchian commented 4 years ago

What We Did Today

What We Will Do Next Time

adilanchian commented 4 years ago

What We Did Today

What We Will Do Next Time

adilanchian commented 4 years ago

What We Did Today

What We Will Do Next Time

adilanchian commented 4 years ago

What We Did Today

What We Will Do Next Time

adilanchian commented 4 years ago

NOTE:

Need to add an expiration time on the Apple Music User Token

adilanchian commented 4 years ago

What We Did Today

What We Will Do Next Time

adilanchian commented 4 years ago

Apple_Auth New design for Apple Auth Flow

adilanchian commented 4 years ago

What We Did Today

What We Will Do Next Time

adilanchian commented 4 years ago

At the beginning of trying to setup our new views, the react-native-navigation library was giving us pains again.... It's time to switch to React-Navigation. I think this needs to happen now as the app is still relatively small. Going to do that now before continuing on here.

adilanchian commented 4 years ago

HERE IS THE NEW FLOW:

  1. Sign in with Apple ID (Standard, built in flow here)
  2. Move onto changing username
  3. Once person creates a playlist, prompt messaging saying that Grüvee can create playlists on your behalf! Would you like this?
  4. If yes, go through Apple Music sign in else, do nothing!
adilanchian commented 4 years ago

What We Did Today

What We Will Do Next Time

adilanchian commented 4 years ago

What We Did Today

What We Will Do Next Time

adilanchian commented 4 years ago

What We Did Today

What We Will Do Next Time

adilanchian commented 4 years ago

What We Did Today

What We Will Do Next Time

adilanchian commented 4 years ago

The Issue

When authenticating with a service provider associated with Firebase, a UID is created for us automatically and we can’t change it. That leaves us with issues in our Firebase Rules to go ahead and access certain documents. Since the custom authenticated users have the proper ID’s.

Potential Solution

Create a new collection that maps firebase auth users to their documents. IE: Firebase User UID: 1234567 —> Firebase User Doc {id: apple:999999}

That would mean all our Firebase rules will probably have to change and the way we fetch documents will probably also have to change.

adilanchian commented 4 years ago

What We Did Today

What We Will Do Next Time

adilanchian commented 4 years ago

Apple Music Prompt Flows:

  1. When creating playlist, prompt user to auth with Apple Music

    • Send to Golang rendered view
    • Auth
    • Create playlist on users behalf
  2. After authing with Apple Music we will need some flag to not prompt the auth again

    • If creating new playlist, we should check this flag
    • If flag is true (saying we have already tried to get user to auth) then don't show prompt and go through proper creation
    • Else show prompt and go through auth if accepted
adilanchian commented 4 years ago

What We Did Today

What We Will Do Next Time

adilanchian commented 4 years ago

What We Did Today

What We Will Do Next Time

adilanchian commented 4 years ago

What We Did Today

What We Will Do Next Time

adilanchian commented 4 years ago

What We Did Today

What We Will Do Next Time

adilanchian commented 4 years ago

What We Did Today

What We Will Do Next Time

adilanchian commented 4 years ago

What We Did Today

What We Will Do Next Time

adilanchian commented 4 years ago

What We Did Today

What We Will Do Next Time

adilanchian commented 4 years ago

What We Did Today

What We Will Do Tomorrow

adilanchian commented 4 years ago

(Testing this out in dev first) So some notes:

  1. In CreateAppleDevToken function, we need to store our .p8 file in a storage bucket.
  2. In our Firebase function we will need to grab these file from our bucket to mint our token
  3. Security rule behind this is we should probably just be admin

What We Did Today

What We Will Do Next Time

adilanchian commented 4 years ago

What We Did Today

What We Will Do Next Time

adilanchian commented 4 years ago

What We Did Today

What We Will To Next Time

adilanchian commented 4 years ago

All the issues we were having last week with accessing the new functions in prod is like 75% fixed now. I had to move two functions from the client to Firebase Functions as there was no authentication at the point of calling these queries so gotta do em in the cloud! Just have to deal with a few more firebase rules (all the actions for playlists and such).

Then we will need to deploy two more functions to the cloud, update the firebase rules and then we can move on hahaha

adilanchian commented 4 years ago

What We Did Today

What We Will Do Next Time

adilanchian commented 4 years ago

What We Did Today

What We Will Do Next Time

adilanchian commented 4 years ago

What We Did Today

What We Will Do Next Time

adilanchian commented 4 years ago

We are finally done.... WOW.