Vis4Sense / HistoryMap

http://sensemap.io
60 stars 7 forks source link

User Login #85

Closed RedayY closed 7 years ago

RedayY commented 7 years ago

The Goal here is to use MongoDB and create a way for users to login and register.

kaidatavis commented 7 years ago

Good to see you started on this. Have you finished the testing for the node/edge creation yet? Please do that first.

RedayY commented 7 years ago

Research Update: -Methods such as PHP usage for mongo or node js (also discussed in gitter) are not really Ideal ways to offer a login solution inside of the Sense map Chrome Extension. -Google via their Access API a way to login and register using a google account. https://developer.chrome.com/apps/app_identity -Google Access works with JavaScript and I can imagine it fitting very well into Sensemap. -RestAPI offers usage of MongoDB in a Chrome Extension (MongoDB driver)

RedayY commented 7 years ago

Update: Currently Working on a minor prototype.

Questions and Thoughts:

Do we have a remote MongoDB DB ? Do we want to use Google Access ?

shahzaibkhan commented 7 years ago

@RedayY here you go: https://developer.chrome.com/apps/app_identity this doc should help you setup signin for chrome extension

kaidatavis commented 7 years ago

Good to see the discussions! Google Access API seems the most promising way. Let's try and see if we can get it to work.

kaidatavis commented 7 years ago

@RedayY and @shahzaibkhan, since you are both on the backend team, I will leave it to you two to decide how to best work together. You can work on the same thing together (for example both look into the Access API), divide the work (for example one implements the other tests), or try both and see which works better.

RedayY commented 7 years ago

@kaimdx Do we have a remote MongoDB DB ?

kaidatavis commented 7 years ago

Yes, it is hosted on the bigdata.mdx.ac.uk. I don't know the access details. @phongvis probably knows more about this.

kaidatavis commented 7 years ago

@RedayY @shahzaibkhan the link in your post is for 'chrome app' development, which is different from 'chrome extension' development. Actually, chrome app will be deprecated soon. The link to the chrome.identity documentation for extension is here: https://developer.chrome.com/extensions/app_identity. Luckily the two seem to be the same in this case, but they can be quite different.

kaidatavis commented 7 years ago

To get the 'OAuth2 client ID', you will need to access to the 'Google APIs Console'. I am not sure if this has to be the one used to registered the extension in the chrome shop. If this is the case, @phongvis will have the access as he added the extension to chrome store.

kaidatavis commented 7 years ago

Also, there are to different types of user login in chrome. One is for the browser and you can see this from the chrome setting menu:

screen shot 2017-07-31 at 23 32 25

The other is for google services, such as gmail and calendar

screen shot 2017-07-31 at 23 34 16

Even though it is both me in the two screenshot, the two logins are different. If I sign-in in the browser but not google service, I won't be able access my gmail etc. I am not sure if this affects chrome.identity, which I suspect is the google service login.

kaidatavis commented 7 years ago

As mentioned in my email, we will follow the 'behaviour --> test --> code' routine, so let's start with the behaviour. Shahzaib already started a wiki page for this https://github.com/Vis4Sense/SenseMapExtension/wiki/Behaviour:-Backend, but we need to focus on the user behaviour and avoid implementation details. Below are the comments I sent to Shahzaib earlier and you can use this as an example: https://github.com/Vis4Sense/SenseMapExtension/wiki/Behaviour%3A-Browser-Window

1) Cover the process of different possibilities. For example, for user login, it should be something like:

Of course this will evolve as development progress, for example what happens when there is no internet connection or lose connection after started? what about logging off?

2) Does not include any implementation details. For example, 'Generate Unique ID based on the email address’ will not be part of the description, as it is part of the implementation and not directly related to user behaviour.

RedayY commented 7 years ago

@kaimdx @phongvis 'OAuth2 client ID' Could one of you give me a hand with this ? I think this has to be done by any of you, as it requires me to have a project on chrome to request this.

RedayY commented 7 years ago

^ in regards of logging in with different sources not just google this also will be helpful https://developers.google.com/identity/protocols/OpenIDConnect

RedayY commented 7 years ago

Get your OAuth2 client ID

You need to register your app in the Google APIs Console to get the client ID:

kaidatavis commented 7 years ago

@kaimdx @phongvis 'OAuth2 client ID' Could one of you give me a hand with this ? I think this has to be done by any of you, as it requires me to have a project on chrome to request this.

@phongvis can you help Reday with this, as you added SenseMap to the Chrome store?

kaidatavis commented 7 years ago

in regards of logging in with different sources not just google this also will be helpful https://developers.google.com/identity/protocols/OpenIDConnect

I assume this will work with any website that follow this standard.

So chrome.identity api can be used to access OAuth 2.0?

RedayY commented 7 years ago

in regards of logging in with different sources not just google this also will be helpful https://developers.google.com/identity/protocols/OpenIDConnect I assume this will work with any website that follow this standard.

So chrome.identity api can be used to access OAuth2.0

Yea it uses OAuth2.0, we can also use OAuth 2.0 to add different ways besides google to login. For now I am working on getting Google Login working, as soon as I got the information from phong :)

RedayY commented 7 years ago

I updated the Wiki too btw

phongvis commented 7 years ago

I created several of them before. Can you try this one and let me know if it works:

Client ID 863635378390-j7mi19t67vigdc4393us6r9cbm7mr49d.apps.googleusercontent.com Client secret fqodH_Wgus5LiO5YPreL1HbE

RedayY commented 7 years ago

Will do thank you :)

RedayY commented 7 years ago

Update:

Here is a youtube video explaining everything: https://youtu.be/d-54zYIe8l0

Still need to do the following:

RedayY commented 7 years ago

For Anyone late night/morning reading this by any chance Video is Uploading.

RedayY commented 7 years ago

https://github.com/Vis4Sense/SenseMapExtension/tree/rebuild-Login

RedayY commented 7 years ago

Update:

Don't be afraid to try it out :)

kaidatavis commented 7 years ago

That's great progress! I can run the login branch locally and it seems to work fine as you showed in the video, which is quite helpful.

kaidatavis commented 7 years ago

I will go through the 'behaviour' wiki for the login later today, so you can start creating some tests.

kaidatavis commented 7 years ago

There were two file reference errors, which I fixed in my commit. Also, I got the following error when tried to log in:

screen shot 2017-08-14 at 12 50 35

RedayY commented 7 years ago

Hmmm did you change the reference Uri ?

RedayY commented 7 years ago

This error only appears when the redirect Uri mismatches from the one we used in the chrome API developer console

kaidatavis commented 7 years ago

I didn't change any URL. Actually which URL in which is file?

Sent from my Samsung SM-G920F using FastHub

RedayY commented 7 years ago

Sorry for the late reply I am looking into this right now

RedayY commented 7 years ago

Right So I just Synced the Branch and tested the login, it is working as intended.

Are you sure you're using rebuild-Login ?

45abefc307aa499d726f8f28b3380187

rebuild-Reday has an outdated version of the login. The latest and working one is in rebuild-Login

kaidatavis commented 7 years ago

I made a screencast for the error: https://streamable.com/2otio

RedayY commented 7 years ago

Hmmm could you kindly check the following file :" initHelloOauth.js " in \SenseMapExtension\tests\Reday\dummylogin

to match like this 89513839fd5ee2169e0764af12cbfbad

It is strange that it said that the Redirect URL is unreachable, as if the sensemap extension would have a diffrent ID on your Installation

RedayY commented 7 years ago

Actually I just noticed in your video, the ID of the extension is different on my end than on yours

RedayY commented 7 years ago

for me the link on sensemap is lajblbdkejaddpihfeeihnicfkmiojem and yours seems to be starting with gekhbinh

RedayY commented 7 years ago

This is why the Redirect URL not reachable. because the extension is looking for https://lajblbdkejaddpihfeeihnicfkmiojem.chromiumapp.org/tests/Reday/dummylogin/index.html, where yours would actually be something like https://gekhbinh*somethingsomething.chromiumapp.org/tests/Reday/dummylogin/index.html

RedayY commented 7 years ago

Would you mind trying to remove SenseMap from chrome and reloading it from the branch to see if the id changed ?

kaidatavis commented 7 years ago

I think it is the same. See the screenshot of the same file on my laptop. I committed my local version into your branch, so you can see my version of the code in the latest commit and the changes (diff) here: https://github.com/Vis4Sense/SenseMapExtension/commit/d360f630d788e51959926525eee34d41d3cde2c2.

screen shot 2017-08-14 at 16 13 05

RedayY commented 7 years ago

Yea I found the Issue. On chrome://extensions/ under Sensemap I have a diffrent ID than you. 526303c25f79975d318633b0c60db1fa So In the specification it is looking for https://lajblbdkejaddpihfeeihnicfkmiojem.chromiumapp.org/tests/Reday/dummylogin/index.html/ and if it cannot find it, it wont reach the Authentification Page.

kaidatavis commented 7 years ago

Can you use a relative path such as '/tests/Reday/dummylogin/index.html' rather than a full URL 'https://lajblbdkejaddpihfeeihnicfkmiojem.chromiumapp.org/tests/Reday/dummylogin/index.html'? This loads the index.html file locally rather than online.

RedayY commented 7 years ago

Unfortunately, we need to configure the Authentication Page URL in the Google Developer API console. On there it Only allows links and not paths.

RedayY commented 7 years ago

Do you know why your version of Sensemap has a diffrent ID ?

kaidatavis commented 7 years ago

Probably because the extension is loaded from the source code, so google just assign an ID on the fly.

RedayY commented 7 years ago

So is that also the case with Extensions on the web store ?

kaidatavis commented 7 years ago

I have updated the login behaviour wikipage, please follow the latest version for the testing and code.

RedayY commented 7 years ago

Update:

RedayY commented 7 years ago

Update:

Note: If you want to try login sent me your SenseMap Chrome Extension Local ID, so I can enable Login.

Status:

RedayY commented 7 years ago

Update:

https://gekbinhnlmhidijgdccmnakheaeplado.chromiumapp.org/src/html/popup.html

Note: If you want to try login sent me your SenseMap Chrome Extension Local ID, so I can enable Login.