From 2a6193201e47842b50ea584fc5e23a1615b159f4 Mon Sep 17 00:00:00 2001 From: Tim Hostetler <6970899+thostetler@users.noreply.github.com> Date: Wed, 13 Mar 2024 16:46:13 -0400 Subject: [PATCH 1/3] update reset of 'bearer' strings to 'Bearer' --- package-lock.json | 1 + src/js/modules/orcid/README.md | 68 +++++++++---------- src/js/modules/orcid/orcid_api.js | 2 +- test/mocha/js/modules/orcid/helpers.js | 2 +- test/mocha/js/modules/orcid/orcid_api.spec.js | 4 +- 5 files changed, 39 insertions(+), 38 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7359537a9..68350e9d0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,6 +5,7 @@ "requires": true, "packages": { "": { + "name": "bumblebee", "version": "1.0.0", "hasInstallScript": true, "dependencies": { diff --git a/src/js/modules/orcid/README.md b/src/js/modules/orcid/README.md index cfab3a6de..df71d8f6f 100644 --- a/src/js/modules/orcid/README.md +++ b/src/js/modules/orcid/README.md @@ -85,7 +85,7 @@ Basically, for ADS it goes like this: response is: ``` - {"access_token":"ea12a66a-2a07-49fc-b0cb-9d0967c484c8","token_type":"bearer","expires_in":3599,"scope":"/orcid-works/create /orcid-profile/read-limited /orcid-works/update","orcid":"0000-0001-8178-9506","name":"Roman Chyla"} + {"access_token":"ea12a66a-2a07-49fc-b0cb-9d0967c484c8","token_type":"Bearer","expires_in":3599,"scope":"/orcid-works/create /orcid-profile/read-limited /orcid-works/update","orcid":"0000-0001-8178-9506","name":"Roman Chyla"} ``` then with the access_token, we can start doing stuff: @@ -100,33 +100,33 @@ Alternative, obtain permanent access token (this can be good only for testing, i curl -i -L -H 'Accept: application/json' --data 'client_id=APP-P5ANJTQRRTMA6GXZ&client_secret=989e54c8-7093-4128-935f-30c19ed9158c&grant_type=client_credentials&scope=/orcid-profile/read-limited%20/orcid-works/create%20/orcid-works/update' 'https://api.sandbox.orcid.org/oauth/token' ``` -{"access_token":"8f314d8d-928f-4df1-b276-5be866eac3b2","token_type":"bearer","expires_in":3599,"scope":"/activities/read-limited /activities/update /affiliations/create /affiliations/read-limited /affiliations/update /authenticate /funding/create /funding/read-limited /funding/update /orcid-bio/external-identifiers/create /orcid-bio/read-limited /orcid-bio/update /orcid-profile/read-limited /orcid-works/create /orcid-works/read-limited /orcid-works/update /person/read-limited /person/update /read-public","orcid":null} +{"access_token":"8f314d8d-928f-4df1-b276-5be866eac3b2","token_type":"Bearer","expires_in":3599,"scope":"/activities/read-limited /activities/update /affiliations/create /affiliations/read-limited /affiliations/update /authenticate /funding/create /funding/read-limited /funding/update /orcid-bio/external-identifiers/create /orcid-bio/read-limited /orcid-bio/update /orcid-profile/read-limited /orcid-works/create /orcid-works/read-limited /orcid-works/update /person/read-limited /person/update /read-public","orcid":null} ``` ``` { - "message-version": "1.2", + "message-version": "1.2", "orcid-profile": { - "group-type": null, - "client-type": null, + "group-type": null, + "client-type": null, "orcid-identifier": { - "path": "0000-0001-8178-9506", - "host": "sandbox.orcid.org", - "uri": "http://sandbox.orcid.org/0000-0001-8178-9506", + "path": "0000-0001-8178-9506", + "host": "sandbox.orcid.org", + "uri": "http://sandbox.orcid.org/0000-0001-8178-9506", "value": null - }, + }, "orcid-activities": { - "affiliations": null, + "affiliations": null, "orcid-works": { - "scope": null, + "scope": null, "orcid-work": [ { "work-title": { - "subtitle": null, + "subtitle": null, "title": { "value": "ADS 3.0" } - }, + }, "work-external-identifiers": { "work-external-identifier": [ { @@ -137,53 +137,53 @@ curl -i -L -H 'Accept: application/json' --data 'client_id=APP-P5ANJTQRRTMA6GXZ& }, "last-modified-date": { "value": 1422645668284 - }, + }, "created-date": { "value": 1422645668284 - }, - "visibility": "PUBLIC", - "work-type": "JOURNAL_ARTICLE", + }, + "visibility": "PUBLIC", + "work-type": "JOURNAL_ARTICLE", "publication-date": { "month": { "value": "01" - }, + }, "day": { "value": "01" - }, - "media-type": null, + }, + "media-type": null, "year": { "value": "2015" } - }, + }, "journal-title": { "value": "foo" - }, + }, "url": null } ] } - }, - "orcid": null, - "type": "USER", + }, + "orcid": null, + "type": "USER", "orcid-preferences": { "locale": "EN" - }, + }, "orcid-history": { "last-modified-date": { "value": 1424114629494 - }, - "creation-method": "DIRECT", + }, + "creation-method": "DIRECT", "submission-date": { "value": 1422645321288 - }, + }, "verified-primary-email": { "value": false - }, + }, "verified-email": { "value": false - }, - "visibility": null, - "source": null, + }, + "visibility": null, + "source": null, "claimed": { "value": true } @@ -200,7 +200,7 @@ curl -i -L -H 'Accept: application/json' --data 'client_id=APP-P5ANJTQRRTMA6GXZ& 1.2 - + API Test Title diff --git a/src/js/modules/orcid/orcid_api.js b/src/js/modules/orcid/orcid_api.js index 0c9bf31fb..834e4ec6a 100644 --- a/src/js/modules/orcid/orcid_api.js +++ b/src/js/modules/orcid/orcid_api.js @@ -306,7 +306,7 @@ define([ * Using access code retrieve the access_token from ORCID * * Example response: - * {"access_token":"4274a0f1-36a1-4152-9a6b-4246f166bafe","token_type":"bearer","ex + * {"access_token":"4274a0f1-36a1-4152-9a6b-4246f166bafe","token_type":"Bearer","ex * pires_in":3599,"scope":"/orcid-works/create /orcid-profile/read-limited /orcid-w * orks/update","orcid":"0000-0001-8178-9506","name":"Roman Chyla"} * diff --git a/test/mocha/js/modules/orcid/helpers.js b/test/mocha/js/modules/orcid/helpers.js index 3d0d48386..c009ecf06 100644 --- a/test/mocha/js/modules/orcid/helpers.js +++ b/test/mocha/js/modules/orcid/helpers.js @@ -125,7 +125,7 @@ define(['underscore', 'jquery'], function(_, $) { }, oAuth: { access_token: '4274a0f1-36a1-4152-9a6b-4246f166bafe', - token_type: 'bearer', + token_type: 'Bearer', expires_in: 3599, scope: '/orcid-works/create /orcid-profile/read-limited /orcid-works/update', diff --git a/test/mocha/js/modules/orcid/orcid_api.spec.js b/test/mocha/js/modules/orcid/orcid_api.spec.js index 8d62d5af5..d406edb1b 100644 --- a/test/mocha/js/modules/orcid/orcid_api.spec.js +++ b/test/mocha/js/modules/orcid/orcid_api.spec.js @@ -168,7 +168,7 @@ define([ expect(apiRequest.get('query').get('code')).to.eql(['secret']); return { access_token: '4274a0f1-36a1-4152-9a6b-4246f166bafe', - token_type: 'bearer', + token_type: 'Bearer', expires_in: 3599, scope: '/orcid-works/create /orcid-profile/read-limited /orcid-works/update', @@ -213,7 +213,7 @@ define([ r.done(function(res) { expect(res).to.eql({ access_token: '4274a0f1-36a1-4152-9a6b-4246f166bafe', - token_type: 'bearer', + token_type: 'Bearer', expires_in: 3599, scope: '/orcid-works/create /orcid-profile/read-limited /orcid-works/update', From f587baa20c2b602493ac655c132d56618a2c28a3 Mon Sep 17 00:00:00 2001 From: Tim Hostetler <6970899+thostetler@users.noreply.github.com> Date: Wed, 13 Mar 2024 16:46:25 -0400 Subject: [PATCH 2/3] submodule bump --- src/shared | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared b/src/shared index 60f6e024f..53e9a5539 160000 --- a/src/shared +++ b/src/shared @@ -1 +1 @@ -Subproject commit 60f6e024fa10e148007c2927a9061605dca42f14 +Subproject commit 53e9a5539118e808aea93efe7d32cb4396616cb5 From e4320a703453fa080a60c4a00d47843716fb3342 Mon Sep 17 00:00:00 2001 From: Tim Hostetler <6970899+thostetler@users.noreply.github.com> Date: Thu, 14 Mar 2024 12:00:37 -0400 Subject: [PATCH 3/3] update LOGIN endpoint usage and fix test --- src/js/components/session.js | 2 +- test/mocha/js/components/session.spec.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/js/components/session.js b/src/js/components/session.js index 411fa01be..8c2da84ac 100644 --- a/src/js/components/session.js +++ b/src/js/components/session.js @@ -65,7 +65,7 @@ define([ this.sendRequestWithNewCSRF(function(csrfToken) { var request = new ApiRequest({ - target: ApiTargets.USER, + target: ApiTargets.LOGIN, query: new ApiQuery({}), options: { type: 'POST', diff --git a/test/mocha/js/components/session.spec.js b/test/mocha/js/components/session.spec.js index e19850836..6e5d7fc99 100644 --- a/test/mocha/js/components/session.spec.js +++ b/test/mocha/js/components/session.spec.js @@ -57,7 +57,7 @@ define([ csrfManager.resolvePromiseWithNewKey(); expect(requestStub.args[0][0]).to.be.instanceof(ApiRequest); - expect(requestStub.args[0][0].toJSON().target).to.eql('accounts/user'); + expect(requestStub.args[0][0].toJSON().target).to.eql('accounts/user/login'); expect(requestStub.args[0][0].toJSON().options.type).to.eql('POST'); expect(requestStub.args[0][0].toJSON().options.data).to.eql( '{"username":"goo","password":"foo","g-recaptcha-response":"boo"}'