Skip to content
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

Cannot save manually created activities #94

Closed
jlmcdonald opened this issue Aug 25, 2014 · 38 comments
Closed

Cannot save manually created activities #94

jlmcdonald opened this issue Aug 25, 2014 · 38 comments
Labels

Comments

@jlmcdonald
Copy link

Manually created an activity with the #gdeprogram tracker, input data for title, candidate name, candidate email, and category (#interview); when I clicked on 'save' I got a javascript alert that stated "Only GDEs or Admins may enter or save data." Verified that I was properly authenticated, all my other activities were showing up, etc. Tried again with #forumpost, same result.

@Scarygami
Copy link
Contributor

@jlmcdonald the email address in your "Account" entry is a .edu one. Is this the same email address you use to login? The backend retrieves your email address based on your authentication and matches it against the account list, so they have to be the same. Feel free to contact me less publicly to sort this out :)

@Scarygami
Copy link
Contributor

To check you can call this in the console and see what email you are authenticated with:

gapi.client.plus.people.get({'userId': 'me'}).execute(function(response) { console.log(response.emails[0]); })

@zmandel
Copy link

zmandel commented Aug 25, 2014

I cant save manual activities either, but with a different error.
When I create a new activity, it doesnt let me select anything in the "select type of activity". Then when I hit "Save", it doesnt save and it doesnt show any errors.
console shows:
Uncaught TypeError: Cannot read property 'gde_name' of undefined
Uncaught TypeError: Cannot read property 'totalPlus1s' of undefined

Could it be because the "Activity link" must be a valid public post by me? I havent tried making the public post yet because in this case it doesnt make sense.

@Scarygami
Copy link
Contributor

@zmandel I see several activity records created by you in the datastore, if you refresh the page do you see them in the list? (I can delete the duplicates for you).

@SmokyBob strangely the gde_name field isn't set for those records. Any idea how that can happen?

@jlmcdonald
Copy link
Author

@Scarygami I use the .edu address in the directory but do all posting with a gmail.com address (in my gmail account, the .edu address is usable to log in, however). You're correct that this is probably the issue that's causing the failure, but as I said the app has retrieved all of my posts without a problem, so somewhere it knows to use the gmail.com address? Obviously the easy solution would be to change the GDE account to show my gmail address, but I'd like my .edu address to be the public facing one ...

@Scarygami
Copy link
Contributor

@jlmcdonald for fetching the posts automatically your Google ID is used, so the email address doesn't matter there. But the system is confused because of the Google ID not matching the email in the list.
For now I've updated your email in the datastore manually, can you see if it works for you now?

Only a temporary fix, since the data is updated from a Masterlist.

@SmokyBob do you think we can extend the GDE Masterlist with a second email column, one column as primary contact email (that we don't need in the DB) and one that feeds the Account list where the only purpose of the email is checking the authentication?

@zmandel
Copy link

zmandel commented Aug 25, 2014

@Scarygami yes can you please delete the duplicates?
since I wasnt getting any errors, I thought it wasnt saved. I kept trying to change fields to see if it would save them. thanks!

@jlmcdonald
Copy link
Author

@Scarygami -- as expected that does work, now.

I like your suggestion of having a "primary contact email" and an "account authentication email" column ... that should solve the problem for now (until Google's oAuth implementation can handle multiple emails on the same account!)

@Scarygami
Copy link
Contributor

@zmandel dupes deleted, kept your latest entry since it seemed to contain the most information. If you refresh you should see only one of the activities left now.

@jlmcdonald unfortunately the app engine oauth methods used by cloud endpoints are rather limited and I don't think they will ever expose more than the "primary account email".

@dlew
Copy link

dlew commented Aug 25, 2014

I'm running into the same issue. I see this in the logs:

gdeTrackingAPI.activity_record.insert(DATA) responded with Response Code: 401 - Only GDEs and admins may enter or change data. 

I am not using an alternate email for my login, AFAIK.

@Scarygami
Copy link
Contributor

Hmmm... your configuration looks okay to me @dlew

Can you execute the following command and see if it returns your gmail address?

gapi.client.plus.people.get({'userId': 'me'}).execute(function(response) { console.log(response.emails[0]); })

@SmokyBob
Copy link
Collaborator

As stated by @Scarygami the "contact email" and the email associated with the user account is different.

@Scarygami I think we can push/update the "primary email" with the one associated to the Gplus User when we push data from the Masterlist, and store (if needed) the email from the spreadsheet into a "contact email" field

@zmandel can you please check in the log if you see a "Error during authentication" log?
@Scarygami the gde_name is empty only if the user is not authorized.... or #8 is back again with the double callbacks (first will authenticate you, second deauth cleaning up the account metadata)

@dlew
Copy link

dlew commented Aug 25, 2014

@Scarygami Here's what I get:

Object {value: "danlew42@gmail.com", type: "account"} 

That should be the correct value.

@zmandel
Copy link

zmandel commented Aug 25, 2014

@Scarygami how do I see the log? the console log now shows this when I enter:
GdeApp Backend API LOADED! GdeTrackingApp.js:33
plusLoginCtrl: gde-app-back-end-ready received plusLoginCtrl.js:118
startCtrl: gde-app-back-end-ready received startCtrl.js:120
event emitted GdeTrackingApp.js:37
Welcome Zig Mandel. plusLoginCtrl.js:24
You are a GDE!

but I havent tried committing the activity again since its already there,

@SmokyBob
Copy link
Collaborator

@zmandel if you see only those message you are ok.
Try to update an existing one (simply open and save) to see if everything is working; the same call as creating a new one is used so you the same result

@Scarygami
Copy link
Contributor

@dlew yup, that data matches what is there for you in the backend... confusing since this should work like this without issues, will try to investigate further

@zmandel
Copy link

zmandel commented Aug 25, 2014

@Scarygami I changed the title of the only activity I had from "Chrome extensions" to "Chrome extensions!", saved, and now it ended up with a new, duplicate activity instead of editing the existing one. console doesnt show any errors (other than failed to load many googledrive resources)

@Scarygami
Copy link
Contributor

@zmandel I only see your activity once in the datastore.

@SmokyBob could there be an issue with updating the displayed Activity list after adding/editing data? (haven't noticed myself though)

@SmokyBob
Copy link
Collaborator

@zmandel can you refresh the page and try again (added some logs)?
Try again changing the title and saving; in the log you should see something like these lines
---------DEBUG----------
A lot of stuff

---------DEBUG----------

Can you please post that?

@zmandel
Copy link

zmandel commented Aug 25, 2014

removed the "!" from the title, and again I now have two activities listed.
a page refresh does show a single activity, so its just a display issue.

console:
---------DEBUG----------
editMode:Edit
{"resharers":0,"activity_link":"
https://plus.google.com/+gdglimape/posts/gKt5qqcjzyS?pid=6046164374915020738&oid=110122706499918118028","date_updated":null,"gplus_id":"116555712110481680243","activity_types":["#techtalk"],"comments":0,"post_date":"2014-08-21","gde_name":"","product_groups":["#chrome"],"plus_oners":0,"date_created":null,"activity_title":"Chrome
Extensions Talk @ GDG
Lima","id":"5726146096267264","metadata":[{"impact":25,"description":"Chrome
Extensions","title":"GDG Lima I/O Extended
2014","google_expensed":false,"other_link1":"
https://docs.google.com/document/d/1ChbqGNVslV-ANkOnHpWArasXhuNYzYTxxRKD5BHg_uQ/edit?usp=drive_web
","other_link2":"
https://plus.google.com/+gdglimape/posts/PBz34FENFPh?pid=6050888092259031058&oid=110122706499918118028
","link":"
https://plus.google.com/+gdglimape/posts/gKt5qqcjzyS?pid=6046164374915020738&oid=110122706499918118028","location":"Lima,
Peru","type":"#conference","activity_group":"#techtalk","$$hashKey":"0VC"}],"kind":"gdetracking#activity_recordItem","gplus_posts":[]}
$scope.data.items.length:1
remove from chart array
remove from table array
pushing new item
$scope.data.items.length:2
---------DEBUG----------

Zig Mandel
Google Developer Expert https://developers.google.com/experts/
Lima, Peru

On Mon, Aug 25, 2014 at 5:19 PM, Mauro Solcia notifications@github.com
wrote:

@zmandel https://github.com/zmandel can you refresh the page and try
again (added some logs)?
Try again changing the title and saving; in the log you should see
something like these lines
---------DEBUG----------
A lot of stuff

---------DEBUG----------

Can you please post that?


Reply to this email directly or view it on GitHub
#94 (comment).

@zmandel
Copy link

zmandel commented Aug 25, 2014

also note that I still cant populate the combobox to the right of "title of your app". It doesnt have a displayed name, just the contents "Select type of activity" and a few hashtags in the combobox. I can drop down the combo but I cant select anything into it.

@SmokyBob
Copy link
Collaborator

@zmandel
I was able to reproduce the error on save, it's related to having only one activity, applied a fix on the live version, can you please check?

another thing, can you check the log for "Error in sign in flow."?
The saved activity as gde_name="" that is a sign that the global variable gde_name is empty.

If you find it "Error in sign in flow.", can you please go to https://plus.google.com/apps and de auth "GDE Tracking App", then try again to login.

About the Empty Select type of activity: got it once today, seems like the redirect service (the site is hosted inside a Google Drive Folder) had a bad version of the CSS and displayed the combo too small; refreshed and it's fixed on my end.

Sorry for the inconvenience

@zmandel
Copy link

zmandel commented Aug 25, 2014

I wasnt getting the sign-in error anymore (I havent tried commiting
new activities thou).
I did disconnect the app just in case, and now Im getting these logs:
[note: the XXXX are mine]

Failed to load resource: the server responded with a status of 404
(Not Found) https://www.googleapis.com/plus/v1/people//?key=XXXXSyA00Bh_4YQx34Zc5z_JIlqYQJjNCr2ihV4
Failed to load resource: net::ERR_BLOCKED_BY_CLIENT
http://www.google-analytics.com/analytics.js
GdeApp Backend API LOADED!
plusLoginCtrl: gde-app-back-end-ready received
startCtrl: gde-app-back-end-ready received
event emitted
Error in sign in flow.
Object

client_id: "XXXX2318878-dik3r14d8jc528h1ao35f8ehqa7tmpe1.apps.googleusercontent.com"
cookie_policy: undefined
error: "immediate_failed"
expires_at: "1409095728"
expires_in: "86400"
g_user_cookie_policy: undefined
issued_at: "1409009328"
num_sessions: "1"
response_type: "code token id_token gsession"
scope: "https://www.googleapis.com/auth/plus.login
https://www.googleapis.com/auth/userinfo.email"
session_state: "XXXXabed1a893b609f3ceea899f457109fed1be.8osJnihIf93_aGqD.XXXX"
state: ""
status: Object

google_logged_in: true
method: null
signed_in: false
proto: Object

Error in sign in flow.
Object

client_id: "XXXX2318878-dik3r14d8jc528h1ao35f8ehqa7XXXXX.apps.googleusercontent.com"
cookie_policy: undefined
error: "immediate_failed"
expires_at: "1409095728"
expires_in: "86400"
g_user_cookie_policy: undefined
issued_at: "1409009328"
num_sessions: "1"
response_type: "code token id_token gsession"
scope: "https://www.googleapis.com/auth/plus.login
https://www.googleapis.com/auth/userinfo.email"
session_state: "XXXXXXabed1a893b609f3ceea899f457109fed1be.8osJnihIf93_aGqD.XXXX"
state: ""
status: Object

google_logged_in: true
method: null
signed_in: false
proto: Object

Resource interpreted as Image but transferred with MIME type
text/html: "https://0ef5ddeb4723c66b72ceea3e2b8784165f179820.googledrive.com/host/0B_RClkFMLkcpeDdNSHVmVXdTY0k/404.html".
Zig Mandel
Google Developer Expert
Lima, Peru

On Mon, Aug 25, 2014 at 6:07 PM, Mauro Solcia notifications@github.com wrote:

@zmandel
I was able to reproduce the error on save, it's related to having only one
activity, applied a fix on the live version, can you please check?

another thing, can you check the log for "Error in sign in flow."?
The saved activity as gde_name="" that is a sign that the global variable
gde_name is empty.

If you find it "Error in sign in flow.", can you please go to
https://plus.google.com/apps and de auth "GDE Tracking App", then try again
to login.

About the Empty Select type of activity: got it once today, seems like the
redirect service (the site is hosted inside a Google Drive Folder) had a bad
version of the CSS and displayed the combo too small; refreshed and it's
fixed on my end.

Sorry for the inconvenience


Reply to this email directly or view it on GitHub.

@SmokyBob
Copy link
Collaborator

@zmandel if it's during the page load is "correct" (it's not 100% but still works), if it's after trying to Google Plus Sign-in we have to look deeper into this issue.

@Scarygami
Copy link
Contributor

@dlew we added some logging to check what email address App Engine thinks you have. Can you try again and then comment here so I have a timestamp to check the logs? Thanks :)

@dlew
Copy link

dlew commented Aug 26, 2014

Just tried again - same issue.

@Scarygami
Copy link
Contributor

Thanks, I see the issue now, for whatever reason App Engine thinks your email is CapiTalized which makes the check against the lower-case email fail... easy to fix, stay tuned :)

@dlew
Copy link

dlew commented Aug 26, 2014

Ah, yeah, this is not actually the first time I've run into this problem. I remember having trouble getting signed up as a GDE in the first place due to capitalization.

I'm not actually sure when I capitalized it, probably years ago when I first created this account - I certainly haven't typed it that way in a long time.

@Scarygami
Copy link
Contributor

Yeah, I encountered the same thing with endpoints before. It seems somewhere in the endless halls of Google's data centers your "original" Account name is remembered, and App Engine is one of the only places where this data is still accessed.

@Scarygami
Copy link
Contributor

@dlew can you try again now?

@SmokyBob SmokyBob added the bug label Aug 26, 2014
@dlew
Copy link

dlew commented Aug 28, 2014

@Scarygami Just tried it again, works now, thanks!

@Scarygami
Copy link
Contributor

One issue down, some more to go :)

@jlmcdonald
Copy link
Author

So as I'm returning to manually enter some more activities, I've discovered that, because the datastore has at some point in the last month and a half re-updated itself (and so has a .edu email address for me again), I can no longer log activities. Would the easiest thing be to just have my email address updated in the master list to my gmail account? I don't want anyone to have to manually edit the tracking app datastore every time I need to log some activities (but at the same time, I'd prefer to have my .edu address as the public facing GDE one).

@SmokyBob
Copy link
Collaborator

@jlmcdonald on the Account multiple emails are stored, but not really used by the app.
During the login process emails are used only to check if you are a Googler (email @Google.com) to enable Googlers to access the charts without creating an account for every Googler.

To get the account we use the Google + id of the current logged in user.
In your case the user Id is 117857876649231818427, as linked to the profile https://plus.google.com/117857876649231818427/posts

As long as you login to the app with the account you use for that account the app should work without problems, as you are logging with your "officiale" GDE Account.

@jlmcdonald
Copy link
Author

Right ... we went over this earlier. The issue with my account, however, is
this:

  1. The primary email on the account is jlmcdonald@gmail.com

  2. The email address of jarom_mcdonald@byu.edu is configured as a secondary
    email address for that same account. This isn't something I'm planning on
    changing, as there are particular reasons I set it up this way.

So even if I log in as jarom_mcdonald@byu.edu ... the email address used as
my public GDE address on the master list ... the tracking app (and, in
fact, most google API products) will still report my email address as
jlmcdonald@gmail.com, and hence the tracking app thinks it's not me.

Possible solutions:

  1. Allow multiple email addresses in the GDE master directory, and then
    when the tracking app is checking someone's permissions it will also check
    multiple addresses to see who might be verified.
  2. Have the tracking app's datastore add an extra column for "account
    email" or something like that ... it would have to be set manually for the
    edge cases like mine (could be initially populated by the current
    addresses), but only have to be set once, and then the tracking app would
    verify against it instead of against the addresses that are auto-pulled.
  3. Get the APIs to change so that secondary email addresses can be accessed
    (this isn't likely to happen, obviously)
  4. I can change which email address is listed for me in the GDE master
    directory (I'd prefer not to do this, but as I mentioned before this is
    likely the quickest temporary workaround)

Thoughts?

On Fri, Oct 17, 2014 at 7:41 AM, Mauro Solcia notifications@github.com
wrote:

@jlmcdonald https://github.com/jlmcdonald on the Account multiple
emails are stored, but not really used by the app.
During the login process emails are used only to check if you are a
Googler (email @Google.com) to enable Googlers to access the charts without
creating an account for every Googler.

To get the account we use the Google + id of the current logged in user.
In your case the user Id is 117857876649231818427, as linked to the
profile https://plus.google.com/117857876649231818427/posts

As long as you login to the app with the account you use for that account
the app should work without problems, as you are logging with your
"officiale" GDE Account.


Reply to this email directly or view it on GitHub
#94 (comment).

Dr. Jarom McDonald, PhD
Director, Office of Digital Humanities
Brigham Young University
1163-E JFSB, Provo, UT 84602
801-709-1556
http://google.com/profiles/jlmcdonald

@SmokyBob
Copy link
Collaborator

At the following address you can see you GDEApp account infos.
https://apis-explorer.appspot.com/apis-explorer/?base=https://omega-keep-406.appspot.com/_ah/api#s/gdetracking/v1.0b2/gdetracking.account.get?id=117857876649231818427&_h=1&

As you can see email is not stored anymore.
The application use the ID of the Google Account you are logged in with to make the previous API request, and get the type field to identify if you are a GDE, an Admin or a "registered" Googler.
( See plusLoginCtrl.js from line 10 to 28

I've re enabled a console.log to log the current logged in User Id, could you please check that it's 117857876649231818427 or report the one logged?

@jlmcdonald
Copy link
Author

From the logging data:

gdeTrackingAPI.activity_record.insert(DATA) responded with Response Code:
401 - Only GDEs and admins may enter or change data. myStatisticsCtrl.js:681
{"gplus_id":"117857876649231818427","activity_title":"","activity_link":"","post_date":"2014-09-17","date_updated":null,"date_created":null,"activity_types":["#gdeprogram"],"product_groups":["#html5","#youtube"],"gplus_posts":[],"plus_oners":0,"resharers":0,"comments":0,"metadata":[{"activity_group":"#gdeprogram","$$hashKey":"1AS","title":"Bacely
YoroBi","description":"yorogoule@gmail.com ","type":"#interview"}]}
myStatisticsCtrl.js:682

On Fri, Oct 17, 2014 at 12:34 PM, Mauro Solcia notifications@github.com
wrote:

At the following address you can see you GDEApp account infos.

https://apis-explorer.appspot.com/apis-explorer/?base=https://omega-keep-406.appspot.com/_ah/api#s/gdetracking/v1.0b2/gdetracking.account.get?id=117857876649231818427&_h=1&

As you can see email is not stored anymore.
The application use the ID of the Google Account you are logged in with to
make the previous API request, and get the type field to identify if you
are a GDE, an Admin or a "registered" Googler.
( See plusLoginCtrl.js from line 10
https://github.com/maiera/gde-app/blob/feature/material_design/js/controllers/plusLoginCtrl.js#L10
to 28
https://github.com/maiera/gde-app/blob/feature/material_design/js/controllers/plusLoginCtrl.js#L28

I've re enabled a console.log to log the current logged in User Id, could
you please check that it's 117857876649231818427 or report the one logged?


Reply to this email directly or view it on GitHub
#94 (comment).

Dr. Jarom McDonald, PhD
Director, Office of Digital Humanities
Brigham Young University
1163-E JFSB, Provo, UT 84602
801-709-1556
http://google.com/profiles/jlmcdonald

SmokyBob added a commit that referenced this issue Oct 17, 2014
TEMP fix for issue #94
@SmokyBob
Copy link
Collaborator

@jlmcdonald Thx now I've understood the whole problem.
Gotta change a couple of things on the Masterlist side and open an issue for the changes on the backend.
Meanwhile I've made a patch to use the api key so that you can save activities.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants