Cloudkibo / iOS

iOS Code
0 stars 0 forks source link

Using Cell # Authentication #209

Closed jekram closed 8 years ago

jekram commented 8 years ago

@sumairasaeed

We should change our authentication to Facebook Key and use cell number to validate.

We should only validate on initial install or reinstall. There would be no re-authentication.

Need to follow Whatsapp model when authentications on only done on instal and reinstall.

Facebook is providing the SDK and te library so it should be very little work for us.

This is for 1-1 Call. (Kibo)

Please review the attached video and documentation.

https://developers.facebook.com/videos/f8-2016/account-kit-sms-and-email-login-made-easy/

https://developers.facebook.com/docs/accountkit/overview

Later I will send the credentials.

We will initially implement on Android and iOS and on the Web client later.

@sojharo FYI

sumairasaeed commented 8 years ago

Watched video and read article on it. Downloaded facebook SDK. This is under construction. started following steps given in the documentation.

On Wed, May 25, 2016 at 8:37 AM, Cloudkibo notifications@github.com wrote:

Assigned #209 https://github.com/Cloudkibo/iOS/issues/209 to @sumairasaeed https://github.com/sumairasaeed.

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/Cloudkibo/iOS/issues/209#event-671230647

jekram commented 8 years ago

Thanks. Will this get done by tomorrow? Are there any show stoppers?

Please ONLY implement Cell number and we would do email later.

sumairasaeed commented 8 years ago

The facebook Accounts Kit SDK is in Objective C. I was able to add it to our project. I converted the steps given in documentation from Obj-C to Swift. I also took help from a sample Swift app here https://github.com/elaniin/AccountKit-iOS-Swift . I was able to test this sample app. I have followed all steps given in article, but I am getting one error now of wrong bundle identifier. Looking more into this error.

On Fri, May 27, 2016 at 4:13 AM, Cloudkibo notifications@github.com wrote:

Thanks. Will this get done by tomorrow? Are there any show stoppers?

Please ONLY implement Cell number and we would do email later.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Cloudkibo/iOS/issues/209#issuecomment-222020971, or mute the thread https://github.com/notifications/unsubscribe/AKbhp1cr1Gc8hZOo8O5DoXmtMUKpnFqlks5qFikmgaJpZM4IkAcz .

jekram commented 8 years ago

Have you asked the question on Facebook forum?

Also try implenting their sample app

sumairasaeed commented 8 years ago

No sir. I am getting same error on their sample app too.

On Sat, May 28, 2016 at 1:21 AM, Cloudkibo notifications@github.com wrote:

Have you asked the question on Facebook forum?

Also try implenting their sample app

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Cloudkibo/iOS/issues/209#issuecomment-222244344, or mute the thread https://github.com/notifications/unsubscribe/AKbhp1ClEa1YU-O90G8frw5aliu7wyvOks5qF1JcgaJpZM4IkAcz .

sumairasaeed commented 8 years ago

Looked more into this. I have understood the issue and the solution which will solve this. We need to give "Bundle Identifier" in facebook App dashboard and this should match from Identifier of our application. This is step # 5 here https://developers.facebook.com/docs/ios/getting-started

screen shot 2016-05-28 at 9 45 41 am

From facebook App dashboard, please add this bundle identifier in that field "iCloud.MyAppTemplates.cloudkibo"

sumairasaeed commented 8 years ago

Debugged this further and found that i was entering app-secret id instead of Access Client Token. I took Client Token credentials from sojharo. After this, I was able to get rid of Bundle error and I was able to run the app. It showed me this screen

screen shot 2016-05-28 at 7 27 56 pm

At this time I am getting error on console of Xcode: UserInfo={com.facebook.accountkit:ErrorDeveloperMessageKey=Invalid OAuth access token., NSUnderlyingError=0x1485a3810 {Error Domain=com.facebook.accountkit:ServerError Code=190 "(null)" UserInfo={com.facebook.accountkit:ErrorDeveloperMessageKey=Invalid OAuth access token.}}}

When I enter phone number details, It tries to send code but then fails

screen shot 2016-05-28 at 7 28 10 pm screen shot 2016-05-28 at 7 28 21 pm

Previously, I had found a sample Swift app which used FB Account Kit and it was authenticating successfully by sending SMS. It had their own app-id and client token info there. As a test, I changed their credentials with our credentials. It worked. It sent SMS and was successfully authenticated. Next, I am comparing my code with code of sample app. Also, I found a nice article which has all steps listed in Swift language. It also discussed about the error i am getting. Looking into this too http://media.bemyapp.com/code-tutorial-accountkit-integration-swift-universal-app/

jekram commented 8 years ago

thanks for the update. good progress.

jekram commented 8 years ago

I know this is not complete. However, please push the code and call it Kibo.

jekram commented 8 years ago

Can we customize so we remove reference to Facebook?

sumairasaeed commented 8 years ago

ok sir. Push is in progress. No sir we cannot remove that message which states reference to facebook. We can only change look/feel/theme e.g. color, text style,font etc. Also there is some customisation available for country codes.

On Sat, May 28, 2016 at 8:56 PM, Cloudkibo notifications@github.com wrote:

Can we customize so we remove reference to Facebook?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Cloudkibo/iOS/issues/209#issuecomment-222315441, or mute the thread https://github.com/notifications/unsubscribe/AKbhp2Z10OlDvHgjizPm_H9V2f2yNC8Oks5qGGWjgaJpZM4IkAcz .

jekram commented 8 years ago

Thanks for the update.

sumairasaeed commented 8 years ago

Application name "kibo" was not available. So I have named it "kibo app"

On Sun, May 29, 2016 at 11:52 AM, Cloudkibo notifications@github.com wrote:

Thanks for the update.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Cloudkibo/iOS/issues/209#issuecomment-222345863, or mute the thread https://github.com/notifications/unsubscribe/AKbhp0TgD7SDH8qQ_E1c5-esD0zny1Tvks5qGTevgaJpZM4IkAcz .

sumairasaeed commented 8 years ago

Worked on this. Tried debugging error but could not resolve it yet. Made changes in info.plist file to make it similar to sample app. I created another sample Application on facebook developer. Added iOS platform, app bundle identifier. tried to use its credentials app-id and client token. But error remains. Those credentials are working fine with sample app but not in our cloudkibo app. As next step, creating a new project, will embed cell# authentication in it and will export our project init.

jekram commented 8 years ago

Thanks for the update. I do not need to txt you to get an update.

sumairasaeed commented 8 years ago

Finally able to resolve this. First I looked into project permission settings, but these seemed fine. Then, I created a new project and tried to integrate Account Kit sdk into it. It was successfully embeded. I then tried to import our kibo project into that project. But then there were many errors in linking libraries.

I then thought to first make a copy of our project and then embed sdk into it. So, I did same and it worked. Now it is sending verification code through SMS. On ebtering correct code, it returns Access token. Here are screen shots. I will push this in a while.

screen shot 2016-05-31 at 5 51 33 am screen shot 2016-05-31 at 5 57 43 am screen shot 2016-05-31 at 5 51 43 am
sumairasaeed commented 8 years ago

Push is in progress

jekram commented 8 years ago

Why after cell # authentication it does not go to the screen for it to 1-1 call?

sumairasaeed commented 8 years ago

Sir, currently it is blocked and we cannot login to cloudkibo 1-1 call until server-side work is done. Server has to talk to facebook server and validate if the token is authentic or not. Sojharo is already working on that issue https://github.com/Cloudkibo/CloudKibo/issues/447

On Tue, May 31, 2016 at 3:54 PM, Cloudkibo notifications@github.com wrote:

Why after cell # authentication it does not go to the screen for it to 1-1 call?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Cloudkibo/iOS/issues/209#issuecomment-222655755, or mute the thread https://github.com/notifications/unsubscribe/AKbhpwIAbGfTsMSHnSGTTfbqUg3jvB2cks5qHBODgaJpZM4IkAcz .

jekram commented 8 years ago

I know @sojharo is working on this task.

In your code can you not assume that you have the valid token. Make an internal call and proceed.

sumairasaeed commented 8 years ago

Sir, with every API call, even for fetching contacts from server, we need to send a valid token along with it. In our previous model, we used to receive a valid token when username/password was validated by server. That token was generated by server and sent to us. This token was used as a proof that user is authentic.

Now, facebook server is generating token and giving to us. Our cloudkibo server dont have that token. If we use that token for API calls, cloudkibo server will not recognise it and will treat us as invalid user.

This is why, I have to wait until server side work is done. I have carried other task in the mean time.

Sir, can you please explain what you mean by internal call? Do you mean that we dont fetch contact from server and start call directly just by entering contact name?

On Wed, Jun 1, 2016 at 12:40 AM, Cloudkibo notifications@github.com wrote:

I know @sojharo https://github.com/sojharo is working on this task.

In your code can you not assume that you have the valid token. Make an internal call and proceed.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Cloudkibo/iOS/issues/209#issuecomment-222797303, or mute the thread https://github.com/notifications/unsubscribe/AKbhp51YHM7FXa63ESC8CkFhl02UF2zHks5qHI6hgaJpZM4IkAcz .

jekram commented 8 years ago

@sumairasaeed

I completely agree that we need to get a token from the server. So any call we make to backend it will have validation. Token is there for security purpose. No disagreement there, and we would not launch until we have fixed this issue.

Also, our logic going forward is not based on contact name or username. If we have a contact name, it is good, and if we do not have the contact name and only the phone number, then it is ok. I have many phone number in my phone book with no contact name.

Now once you have imported the phone book we need to go the server to find out who from our list is already on CloudKibo. For this piece of logic to work, we need to have the token.

Without it your address book cannot tell which one is on cloudkibo or not. Correct?

However, for testing purpose, we know which one of these number are on CloudKibo or not. Like yours or mine.

So if I have to establish 1-1 between you and me do I have to go to CloudKibo with the token?

All I am saying that token will be there. However, are we blocked from making incremental progress without the token?

If in my phone book I have your number and in your phone book you have my number. Can we not start the 1-1 Call?

sumairasaeed commented 8 years ago

Right sir. We can fetch phone numbers from address book. But sir, currently on server, we need username essentially to start 1-1 call. Starting call from using phone number is not yet implemented on server side.

On Wed, Jun 1, 2016 at 2:04 AM, Cloudkibo notifications@github.com wrote:

@sumairasaeed https://github.com/sumairasaeed

I completely agree that we need to get a token from the server. So any call we make to backend it will have validation. Token is there for security purpose. No disagreement there, and we would not launch until we have fixed this issue.

Also, our logic going forward is not based on contact name or username. If we have a contact name, it is good, and if we do not have the contact name and only the phone number, then it is ok. I have many phone number in my phone book with no contact name.

Now once you have imported the phone book we need to go the server to find out who from our list is already on CloudKibo. For this piece of logic to work, we need to have the token.

Without it your address book cannot tell which one is on cloudkibo or not. Correct?

However, for testing purpose, we know which one of these number are on CloudKibo or not. Like yours or mine.

So if I have to establish 1-1 between you and me do I have to go to CloudKibo with the token?

All I am saying that token will be there. However, are we blocked from making incremental progress without the token?

If in my phone book I have your number and in your phone book you have my number. Can we not start the 1-1 Call?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Cloudkibo/iOS/issues/209#issuecomment-222820197, or mute the thread https://github.com/notifications/unsubscribe/AKbhpwDdJx0gZNXl4Cm7yRP8kmE0qYfdks5qHKJ2gaJpZM4IkAcz .

jekram commented 8 years ago

Ok. Please describe it how it works

sumairasaeed commented 8 years ago

Sir, here is a diagram showing how it works. We need to pass through Pink colored boxes to start call. Both pink colored boxes needs "username" of callee and caller.

Changes are needed on server side so we can use phone numbers instead of username to instantiate call.

Two things are important to start call presently. 1-user should be online 2-we should know username of user.

screen shot 2016-06-01 at 3 15 42 am
jekram commented 8 years ago

@sumairasaeed

Our old model was based on Username. We had a unique username for each user. If that username was taken, then we asked the user to select a new name. Also, I am not sure if there is any login for Mobile.

We are not going to use "username" going forward. We will be cell# based. Cell# are unique and going forward we do not care about the username.

So there is no username/password it has been replaced by cell# and SMS authentication.

So now 15 people can have jawaid as their username but only I can have 425-890-9414 as a unique cell#.

There is no concept of username with Whatsapp.

I am coping @sojharo here. We need to have common design. I do not think we are on the same page.

@sojharo Please lead with a high-level design on what we are doing going forward.

sumairasaeed commented 8 years ago

Yes sir. I agree and understand your comments. I thought you asked about how our current/old 1-1 call is implemented and i explained that. Agreed that we will have to use phone numbers instead of username as a unique identifier.

jekram commented 8 years ago

@sumairasaeed

During the install we should remove this page. There is is no Login.

img_0055

  1. Why are we showing this last page after the install? img_0042

We should show the contact list.

sumairasaeed commented 8 years ago

Yes sir. I will remove both these pages. Last page was just for testing purpose.

On Wed, Jun 1, 2016 at 6:14 AM, Cloudkibo notifications@github.com wrote:

@sumairasaeed https://github.com/sumairasaeed

During the install we should remove this page. There is is no Login.

[image: img_0055] https://cloud.githubusercontent.com/assets/5336012/15695396/86e227b4-275b-11e6-906f-8f62778ef898.PNG

  1. Why are we showing this last page after the install? [image: img_0042] https://cloud.githubusercontent.com/assets/5336012/15695328/e223cb92-275a-11e6-98ac-2b079c7c42e8.PNG

We should show the contact list.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Cloudkibo/iOS/issues/209#issuecomment-222866802, or mute the thread https://github.com/notifications/unsubscribe/AKbhp7f0QVub7beme-cdZbsYrS3A83N3ks5qHN0FgaJpZM4IkAcz .

sojharo commented 8 years ago

Salaam,

One to one call logic is done on iOS but she can't demonstrate it quickly because the flow to start one to one call is like this:

  1. User is shown his cloudkibo contacts which are fetch from server
  2. User selectes any of them and starts call

After cell authentication, both android and iOS app is not able to receive contacts information from server as server doesn't know that this user is authenticated or not. There is some work required on server side so that cloudkibo server asks from facebook server whether this user is authenticated or not. Then cloudkibo server will maintain that user's information (profile, contacts) on its server. I am currently working on server side work of CloudKibo for this. Sumaira is helping me in testing it too.

Yes, going forward, we would replace username with phone number's only. Currently, the username is required by server to do start handshaking (ringing, picking calls, sending ice candidates) between two users. Whenever client connects to socket.io server of cloudkibo, it stores that client's username. We would do work on cloudkibo server socket.io code so that it accepts phone number instead of username to start one to one call.

sumairasaeed commented 8 years ago

Sir, as my tasks on kibo app are blocked , I am working of Mobile Client issue https://github.com/Cloudkibo/Mobile_Client/issues/12 . Also, helping sojharo in testing server side work of Cloudkibo.

jekram commented 8 years ago

Thanks. This is the right thing to do.