-
Notifications
You must be signed in to change notification settings - Fork 497
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
Adds Credential API and Payment API #91
Conversation
Encountered above error when click close browser button of google signIn authentication pop-up and then persistently occurred above error whenever click on google signIn button. |
@ppshein Odd. There shouldn't be need for manually closing a pop up window opened for Google Sign-In. Can you describe the flow step by step? Make sure to remove all cache from DevTools. |
@agektmr I just clicked google signIn button, then popup is displayed. At that time, click close button of browser instead of no click on Deny and Allow of that popup. After that, popup is closed and spinner was displaying permanently as never disappeared. That's why refresh browser and click on Google SignIn button then show error message as I mentioned above. |
@ppshein Did you put |
@agektmr I just used & tested website link you mentioned above only https://polykart-credential-payment.appspot.com |
@ppshein I just tried with my other gmail account and had no problem. Asked my neighbor to try as well but succeeded. Can you open the page with an incognito mode and try again? |
@agektmr Same as what I tried. Can you try to click on close button of browser without clicking anything on popup box? |
OK, I see what you mean. Issue reproduced. Will look into this. |
@ppshein Can you go back to root page "/" then reload, go back to "/account" and try sign-in? |
@agektmr everything is working correctly when I click "Allow" button of that popup as signing in. Problem is when I click on close button of browser and NOW "deny" button of that popup without going root page and reloading it. |
@ppshein The issue should have been fixed. Can you try again? |
@agektmr same as before in Chrome. Btw, I've deleted all cookie & storage of google chrome.
when open in safari, I've encountered following error in root page.
|
Handling exceptions.
How about this now?
|
@agektmr spinner should be disappeared when I click on close button of popup as should be calling same method of clicking on "Deny" button of it. :) |
@ppshein Hmm, Google Sign-In library doesn't omit reject response. I'll do an investigation but there seems no way to catch closing window as far as I see it now. |
@blasten, PTAL. |
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.
Thanks for the PR! I can move the comments from #70 to this PR if that helps.
|
||
|
||
@app.route('/', defaults={'path': ''}) | ||
@app.route('/<path>') |
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.
I think this is handling only one-level paths. e.g. https://polykart-credential-payment.appspot.com/list works, but https://polykart-credential-payment.appspot.com/list/mens_outerwear doesn't.
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.
I thought this was because AppEngine not handling multi level access correctly. If that's caused by app.route, can you instruct me how to fix?
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.
After some discussion, I think we would like to avoid adding this server-side dependency to the demo. There's nothing wrong with it, but we advise folks to use the PRPL pattern and app engine doesn't have good support for H2 as of last time we tried. Would it be possible to just support Google Sign In by using the Google Sign In element?
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.
I can change to store credentials to local storage for demo purpose. This will take a while to fix though.
<dom-module id="shop-account-data"> | ||
|
||
<template> | ||
<!--<iron-localstorage |
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.
Is the idea that iron-localstorage
would keep the user session alive if I refresh the page?
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.
I intentionally removed it to demonstrate session management (no session over window lifetime at the moment) and auto sign-in. I will add session management using cookie later.
@@ -264,6 +293,15 @@ | |||
</a> | |||
</div> | |||
<div class="logo" main-title><a href="/" aria-label="SHOP Home">SHOP</a></div> | |||
<div class="account-btn-container"> | |||
<a href="/account" tabindex="-1"> | |||
<paper-icon-button |
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.
.left-bar-item's
width should be 80px
now.
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.
Fixed.
<input type="button" on-click="_onSignIn" value="Log In"> | ||
</shop-button> | ||
|
||
<div class="google-signin" on-click="_onGSignIn"> |
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.
If I close the popup without signing in with Google, the loading indicator remains active.
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.
That is a known issue on Google Sign-In side. I'm pinging Google Sign-in engineering team to fix it.
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.
Would it be possible to use the Google sign-in element: https://elements.polymer-project.org/elements/google-signin?view=demo:demo/index.html&active=google-signin?
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.
I'll have a look into it.
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.
I've been looking into google-signin
component but that requires number of changes in order to use it in this code. For example:
- A mechanism to send
id_token
to the server to verify the identity on server side - A mechanism to provide user profile
google-signin
andgoogle-signin-aware
are tightly coupled. I would separategoogle-signin-aware
as a separate component so it can be used without UI.
I can contribute to google-signin
in the future, but it will be a significant work I would just leave it and keep current implementation.
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.
If we don't use google-signin
, could we use the "Sign in" design of the google-signin element? That design seems to fit better with the current shop's design.
Also, <div class="google-signin">
-> <button>
so it's accessible.
|
||
|
||
@app.route('/', defaults={'path': ''}) | ||
@app.route('/<path>') |
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.
After some discussion, I think we would like to avoid adding this server-side dependency to the demo. There's nothing wrong with it, but we advise folks to use the PRPL pattern and app engine doesn't have good support for H2 as of last time we tried. Would it be possible to just support Google Sign In by using the Google Sign In element?
Any progress? |
I was busy with Chrome Dev Summit. Will resume the work. |
OK, I've removed server side code and created a service worker based mock server (Phew). |
index.html
Outdated
@@ -17,6 +17,9 @@ | |||
<title>SHOP</title> | |||
|
|||
<link rel="shortcut icon" sizes="32x32" href="/images/shop-icon-32.png"> | |||
<meta name="google-signin-client_id" content="569649340112-da0ku71mend03mdsu9h7skmv33r2qkg2.apps.googleusercontent.com"> | |||
<script src="https://apis.google.com/js/platform.js"></script> |
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.
Would it be possible to remove https://apis.google.com/js/platform.js or load it async?
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.
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.
Good suggestion. I've used google-js-api
as a dependency.
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.
@agektmr, could you please explain why you don't use https://beta.webcomponents.org/element/GoogleWebComponents/google-signin/google-signin element? It uses google-js-api
under the hood.
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.
It can't handle id_token.
index.html
Outdated
@@ -17,6 +17,9 @@ | |||
<title>SHOP</title> | |||
|
|||
<link rel="shortcut icon" sizes="32x32" href="/images/shop-icon-32.png"> | |||
<meta name="google-signin-client_id" content="569649340112-da0ku71mend03mdsu9h7skmv33r2qkg2.apps.googleusercontent.com"> | |||
<script src="https://apis.google.com/js/platform.js"></script> | |||
<script src="/bower_components/fetch/fetch.js"></script> |
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.
If fetch
requires a Polyfill, then we should use XHR.
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.
@blasten, fetch is a polyfill, and since all modern browsers implement the window.fetch
function natively, no code from this project actually takes any effect in these browsers. Please note that older browsers require Promise
polyfill for fetch
work.
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.
Unfortunately Credential Management API mandates fetch
for AJAX.
<input type="button" on-click="_onSignIn" value="Log In"> | ||
</shop-button> | ||
|
||
<div class="google-signin" on-click="_onGSignIn"> |
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.
If we don't use google-signin
, could we use the "Sign in" design of the google-signin element? That design seems to fit better with the current shop's design.
Also, <div class="google-signin">
-> <button>
so it's accessible.
@agektmr Thanks for the update! I left a few comments, but let me know if you would like me to help. If you add permissions to your copy, I could push a few changes. |
@blasten I've addressed all feedback. One remaining bit I have is if I should add a Promise polyfill or not. Without promises, there will be a major rewrite. What is the general policy on promise in Polymer team? |
@agektmr Thanks for taking the time and sorry for the long time in getting this PR merged! We wanted to make sure that it won't have any perf regression. In that spirit, I have created the branch |
@blasten That is great to hear. I'll send a separate PR. |
PR merged! cc @frankiefu |
62b8560
to
a9fa2f1
Compare
@frankiefu @blasten @agektmr Any plans to merge it to the |
Display a total by adding the amounts of individual line items in shopping cart.
Display totals for shopping cart
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored by someone other than the pull request submitter. We need to confirm that they're okay with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the |
My understanding is this PR is no longer relevant. Please close if that's ok. |
On 20 Dec 2016 your pull request #104 was merged by @blasten to credential-payment-api branch and closed, but for some reasons it was not merged to the |
From my understanding this branch/PR was made as a proof-of-concept of how Web Payments can be integrated into Shop, which is not necessarily part of Shop's primary goal of showing how to build a fast front-end PWA with Polymer. Feel free to examine this PR to get a sense of what is required, but otherwise I'm going to close this PR. |
Adding Credential API and Payment API a la my demo introduced at Polymer Summit session. This is a continuation work of #70 .