-
Notifications
You must be signed in to change notification settings - Fork 3
Google sign ins #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
andrew-d-gordon
wants to merge
20
commits into
main
Choose a base branch
from
googleSignIns
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Google sign ins #33
Changes from 5 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
4edaa55
Added google sign in api imports and basic div inits
61f607e
Added Google Sign in button, can be seen through running firebase emu…
2ecad89
Added Google Sign In functionality, fixed ability to go off edges of …
e6c47af
Refactored comments signIn.js
8b0a7ab
Refactored initSignInV2
0dff9b3
Added sign in token verification and error handling, higher def logo …
e19aa27
Added user sign in recognition, users collection setup in firestore, …
b5d33b6
Set userID as global var in functions/index.js
23eab90
Reconfigured ports which firebase emulators:start runs processes on
cf774c2
Added vote tracking by place per user, must be a user to rate places
c5f2bf2
Update README.md
b829794
Update README.md
bbea31c
Refactored comments, modularized public/js files
354bf3f
Moved retrieval of requests to the server side, fix needed for photo …
dd92bba
Refactored variables, removed unnecessary comments cuisineSearch.js
5a4150b
Removed unnecessary comments cuisineTypeSearch
591dec5
Changed latlng to location attribute in functions/index.js retrieveRe…
f9cfacc
Added APICacheDesign.md for design of implementing caching
d9bcbe5
Added DatabaseDesign.md discussing organization of database
483302b
Removed unnecessary comment apiRequests.js
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| var auth2; | ||
|
|
||
| // Ensure auth2 object is initialized (important for signout), then load button | ||
| function initSigninV2() { | ||
| gapi.load('auth2', function() { | ||
| gapi.auth2.init({ | ||
| client_id: '609530060923-6a276d3itljrb5986lq2tlrgiudduafc.apps.googleusercontent.com' | ||
| }).then(function (authInstance) { | ||
| console.log("Making auth instance"); | ||
| auth2 = authInstance; | ||
| renderButton(); | ||
| }); | ||
| }); | ||
| } | ||
|
|
||
| // Render the google sign in button as well as information scope | ||
| function renderButton() { | ||
| // Set scope and success/failure functions | ||
| gapi.signin2.render('my-signin2', { | ||
| 'scope': 'profile email', | ||
| 'width': 240, | ||
| 'height': 42, | ||
| 'longtitle': true, | ||
| 'theme': 'dark', | ||
| 'onsuccess': onSuccess, | ||
| 'onfailure': onFailure | ||
| }); | ||
| } | ||
|
|
||
| // On successful user sign in, retrieve and store pertinent information | ||
| function onSuccess(googleUser) { | ||
| var profile = googleUser.getBasicProfile(); | ||
| console.log('User ID: ' + profile.getId()); // Do not send to your backend! Use an ID token instead. | ||
| console.log('Logged in as: ' + profile.getName()); | ||
| console.log('User Image URL: ' + profile.getImageUrl()); | ||
| console.log('User email: ' + profile.getEmail()); // Will be null if email scope not set | ||
| document.getElementById("my-signin2").style.display = 'none'; | ||
| document.getElementById("signout").style.display = 'block'; | ||
| } | ||
|
|
||
| // If sign in fails | ||
| function onFailure(error) { | ||
| console.log(error); | ||
| } | ||
|
|
||
| // Attempt to sign user out | ||
| function signOut() { | ||
| console.log("Signing user out") | ||
| if (auth2 != null) { | ||
| auth2.signOut().then(function () { | ||
| auth2.disconnect(); | ||
| //Make sign in button reappear, hide sign out button | ||
| document.getElementById("signout").style.display = 'none'; | ||
| document.getElementById("my-signin2").style.display = 'block'; | ||
| }); | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where does this clientid come from?