Fix Google extension authentication flow. Closes #3991. (#4223)

This prevents consecutive requests to the /authorized endpoint from requesting authorization
multiple times to Google (only the first time succeeds).
This commit is contained in:
Antonin Delpeuch 2021-10-22 08:57:02 +02:00 committed by GitHub
parent 6372f2d382
commit adfe1aa925
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -105,6 +105,9 @@ function process(path, request, response) {
context.state = request.getParameter("state");
(function() {
if (Packages.com.google.refine.extension.gdata.TokenCookie.getToken(request) !== null) {
return;
}
var tokenAndExpiresInSeconds = Packages.com.google.refine.extension.gdata.GoogleAPIExtension.getTokenFromCode(module,request);
if (tokenAndExpiresInSeconds) {
var tokenInfo = tokenAndExpiresInSeconds.split(",");