CDLUC3 / dmptool

DMPTool version of the DMPRoadmap codebase
https://dmptool.org
MIT License
56 stars 13 forks source link

Error on ORCID #497

Closed fcsousaunifesp closed 3 months ago

fcsousaunifesp commented 11 months ago

Good afternoon team. we have the following situation. When completing the plan according to screen 1, and accessing the ORCID item, we are forwarded to screen 2. After filling in the researcher's ORCID data, we have screen 3 as a result. How can we check such an error?

My version is v4.0.9

Bets regards

tela1 tela2 tela3

briri commented 11 months ago

Hey @fcsousaunifesp in order for that to work you need to be an ORCID member.

If not you should be able to justest the enable_orcid_publication in the config/dmproadmap.yml` file to false.

If you are, you need to make sure that your ORCID credentials are in your Rails credentials file or overridden with an ENV variable or.env file depending on how you have your Rails config working.

If using the credentials file you need to define:

dmproadmap:
  orcid_client_id: [Your ID]
  orcid_client_secret: [Your secret]
  orcid_sandbox: [true or false depending on whether you're in prod or not]

For ENV variables use:

DMPROADMAP_ORCID_CLIENT_ID=[Your ID]
DMPROADMAP_ORCID_CLIENT_SECRET=[Your secret]
DMPROADMAP_ORCID_SANDBOX=[true or false depending on whether you're in prod or not]

If it is working successfully, it will store the user's access token from ORCID in the external_api_access_tokens table.

fcsousaunifesp commented 11 months ago

Hello team.

I performed all the settings and now I get this error. Any idea how I can solve it.

(orcid) Authentication failure! csrf_detected: OmniAuth::Strategies::OAuth2::CallbackError, csrf_detected | CSRF detected Processing by Users::OmniauthCallbacksController#failure as HTML Parameters: {"code"=>"[FILTERED]", "state"=>"e7627b7dd55de8d550e95a8ff9e578958e927334549154c8"} OmniauthCallbacksController - FAILURE for orcid Redirected to https://pgd.ibict.br/ Completed 302 Found in 4ms (ActiveRecord: 0.0ms | Allocations: 1452)

Best Regards

Flavio Castro de Sousa

Em sex., 28 de jul. de 2023 às 16:13, Brian Riley @.***> escreveu:

Hey @fcsousaunifesp https://github.com/fcsousaunifesp in order for that to work you need to be an ORCID member.

If not you should be able to justest the enable_orcid_publication in the config/dmproadmap.yml` file to false.

If you are, you need to make sure that your ORCID credentials are in your Rails credentials file or overridden with an ENV variable or.env file depending on how you have your Rails config working.

If using the credentials file you need to define:

dmproadmap: orcid_client_id: [Your ID] orcid_client_secret: [Your secret] orcid_sandbox: [true or false depending on whether you're in prod or not]

For ENV variables use:

DMPROADMAP_ORCID_CLIENT_ID=[Your ID] DMPROADMAP_ORCID_CLIENT_SECRET=[Your secret] DMPROADMAP_ORCID_SANDBOX=[true or false depending on whether you're in prod or not]

If it is working successfully, it will store the user's access token from ORCID in the external_api_access_tokens table.

— Reply to this email directly, view it on GitHub https://github.com/CDLUC3/dmptool/issues/497#issuecomment-1656202077, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHT6WYG2DQHGTO5T7JXZFCTXSQFNDANCNFSM6AAAAAA232ZE6Y . You are receiving this because you were mentioned.Message ID: @.***>

-- Flavio Castro de Sousa Técnico em Tecnologia da Informação Superintendência de Tecnologia da Informação UNIFESP - Reitoria Rua Sena Madureira, 1500 – 4º andar Voip 8581

briri commented 11 months ago

Hmm. Are you brought to the ORCID login screen and asked to sign in and authorize the connection?

I would suggest placing some debug statements in this controller to see if you can get more information into what might be happening. https://github.com/CDLUC3/dmptool/blob/50807bf43efddae5f5c1ef6d3dbe989d8a514809/app/controllers/users/omniauth_callbacks_controller.rb#L24

Make sure that you have the correct callback URLs defined in the developer tools section of the ORCID website. You should have https://pgd.ibict.br/users/auth/orcid/callback (you will want ones for your test environment if you have one setup and perhaps localhost as well if you do development on your local machine)

fcsousaunifesp commented 11 months ago

Hello. I am taken to the ORCID login screen. I receive a valid authentication, with my institutional login and password. But I get this error message I'm inserting the suggested snippet but without changes

Best Regards

Flavio Castro de Sousa

Em seg., 14 de ago. de 2023 às 12:33, Brian Riley @.***> escreveu:

Hmm. Are you brought to the ORCID login screen and asked to sign in and authorize the connection?

I would suggest placing some debug statements in this controller to see if you can get more information into what might be happening. https://github.com/CDLUC3/dmptool/blob/50807bf43efddae5f5c1ef6d3dbe989d8a514809/app/controllers/users/omniauth_callbacks_controller.rb#L24

Make sure that you have the correct callback URLs defined in the developer tools section of the ORCID website. You should have https://pgd.ibict.br/users/auth/orcid/callback (you will want ones for your test environment if you have one setup and perhaps localhost as well if you do development on your local machine)

— Reply to this email directly, view it on GitHub https://github.com/CDLUC3/dmptool/issues/497#issuecomment-1677566175, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHT6WYDQJG7IAURVS4WJBMLXVJAN7ANCNFSM6AAAAAA232ZE6Y . You are receiving this because you were mentioned.Message ID: @.***>

-- Flavio Castro de Sousa Técnico em Tecnologia da Informação Superintendência de Tecnologia da Informação UNIFESP - Reitoria Rua Sena Madureira, 1500 – 4º andar Voip 8581

fcsousaunifesp commented 11 months ago

Can we arrange a meeting for you to review our code?

Thanks

Flavio Castro

Em seg., 14 de ago. de 2023 às 13:53, Flavio Castro de Sousa < @.***> escreveu:

Hello. I am taken to the ORCID login screen. I receive a valid authentication, with my institutional login and password. But I get this error message I'm inserting the suggested snippet but without changes

Best Regards

Flavio Castro de Sousa

Em seg., 14 de ago. de 2023 às 12:33, Brian Riley < @.***> escreveu:

Hmm. Are you brought to the ORCID login screen and asked to sign in and authorize the connection?

I would suggest placing some debug statements in this controller to see if you can get more information into what might be happening. https://github.com/CDLUC3/dmptool/blob/50807bf43efddae5f5c1ef6d3dbe989d8a514809/app/controllers/users/omniauth_callbacks_controller.rb#L24

Make sure that you have the correct callback URLs defined in the developer tools section of the ORCID website. You should have https://pgd.ibict.br/users/auth/orcid/callback (you will want ones for your test environment if you have one setup and perhaps localhost as well if you do development on your local machine)

— Reply to this email directly, view it on GitHub https://github.com/CDLUC3/dmptool/issues/497#issuecomment-1677566175, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHT6WYDQJG7IAURVS4WJBMLXVJAN7ANCNFSM6AAAAAA232ZE6Y . You are receiving this because you were mentioned.Message ID: @.***>

-- Flavio Castro de Sousa Técnico em Tecnologia da Informação Superintendência de Tecnologia da Informação UNIFESP - Reitoria Rua Sena Madureira, 1500 – 4º andar Voip 8581

-- Flavio Castro de Sousa Técnico em Tecnologia da Informação Superintendência de Tecnologia da Informação UNIFESP - Reitoria Rua Sena Madureira, 1500 – 4º andar Voip 8581

marisastrong commented 11 months ago

Have you been successful with the workflow using just ORCID credentials and not the institutional login?


From: fcsousaunifesp @.> Sent: Monday, August 14, 2023 10:05 AM To: CDLUC3/dmptool @.> Cc: Subscribed @.***> Subject: Re: [CDLUC3/dmptool] Error on ORCID (Issue #497)

CAUTION: EXTERNAL EMAIL

Can we arrange a meeting for you to review our code?

Thanks

Flavio Castro

Em seg., 14 de ago. de 2023 às 13:53, Flavio Castro de Sousa < @.***> escreveu:

Hello. I am taken to the ORCID login screen. I receive a valid authentication, with my institutional login and password. But I get this error message I'm inserting the suggested snippet but without changes

Best Regards

Flavio Castro de Sousa

Em seg., 14 de ago. de 2023 às 12:33, Brian Riley < @.***> escreveu:

Hmm. Are you brought to the ORCID login screen and asked to sign in and authorize the connection?

I would suggest placing some debug statements in this controller to see if you can get more information into what might be happening. https://github.com/CDLUC3/dmptool/blob/50807bf43efddae5f5c1ef6d3dbe989d8a514809/app/controllers/users/omniauth_callbacks_controller.rb#L24

Make sure that you have the correct callback URLs defined in the developer tools section of the ORCID website. You should have https://pgd.ibict.br/users/auth/orcid/callback (you will want ones for your test environment if you have one setup and perhaps localhost as well if you do development on your local machine)

— Reply to this email directly, view it on GitHub https://github.com/CDLUC3/dmptool/issues/497#issuecomment-1677566175, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHT6WYDQJG7IAURVS4WJBMLXVJAN7ANCNFSM6AAAAAA232ZE6Y . You are receiving this because you were mentioned.Message ID: @.***>

-- Flavio Castro de Sousa Técnico em Tecnologia da Informação Superintendência de Tecnologia da Informação UNIFESP - Reitoria Rua Sena Madureira, 1500 – 4º andar Voip 8581

-- Flavio Castro de Sousa Técnico em Tecnologia da Informação Superintendência de Tecnologia da Informação UNIFESP - Reitoria Rua Sena Madureira, 1500 – 4º andar Voip 8581

— Reply to this email directly, view it on GitHubhttps://github.com/CDLUC3/dmptool/issues/497#issuecomment-1677719510, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAGF4LZIIN4XSE3PYOCMD6DXVJLFHANCNFSM6AAAAAA232ZE6Y. You are receiving this because you are subscribed to this thread.Message ID: @.***>

fcsousaunifesp commented 11 months ago

I had no success, neither with the institutional login nor with the orcid login I'm still studying the logs.

Em seg., 14 de ago. de 2023 às 14:10, marisa strong < @.***> escreveu:

Have you been successful with the workflow using just ORCID credentials and not the institutional login?


From: fcsousaunifesp @.> Sent: Monday, August 14, 2023 10:05 AM To: CDLUC3/dmptool @.> Cc: Subscribed @.***> Subject: Re: [CDLUC3/dmptool] Error on ORCID (Issue #497)

CAUTION: EXTERNAL EMAIL

Can we arrange a meeting for you to review our code?

Thanks

Flavio Castro

Em seg., 14 de ago. de 2023 às 13:53, Flavio Castro de Sousa < @.***> escreveu:

Hello. I am taken to the ORCID login screen. I receive a valid authentication, with my institutional login and password. But I get this error message I'm inserting the suggested snippet but without changes

Best Regards

Flavio Castro de Sousa

Em seg., 14 de ago. de 2023 às 12:33, Brian Riley < @.***> escreveu:

Hmm. Are you brought to the ORCID login screen and asked to sign in and authorize the connection?

I would suggest placing some debug statements in this controller to see if you can get more information into what might be happening.

https://github.com/CDLUC3/dmptool/blob/50807bf43efddae5f5c1ef6d3dbe989d8a514809/app/controllers/users/omniauth_callbacks_controller.rb#L24

Make sure that you have the correct callback URLs defined in the developer tools section of the ORCID website. You should have https://pgd.ibict.br/users/auth/orcid/callback (you will want ones for your test environment if you have one setup and perhaps localhost as well if you do development on your local machine)

— Reply to this email directly, view it on GitHub https://github.com/CDLUC3/dmptool/issues/497#issuecomment-1677566175,

or unsubscribe < https://github.com/notifications/unsubscribe-auth/AHT6WYDQJG7IAURVS4WJBMLXVJAN7ANCNFSM6AAAAAA232ZE6Y>

. You are receiving this because you were mentioned.Message ID: @.***>

-- Flavio Castro de Sousa Técnico em Tecnologia da Informação Superintendência de Tecnologia da Informação UNIFESP - Reitoria Rua Sena Madureira, 1500 – 4º andar Voip 8581

-- Flavio Castro de Sousa Técnico em Tecnologia da Informação Superintendência de Tecnologia da Informação UNIFESP - Reitoria Rua Sena Madureira, 1500 – 4º andar Voip 8581

— Reply to this email directly, view it on GitHub< https://github.com/CDLUC3/dmptool/issues/497#issuecomment-1677719510>, or unsubscribe< https://github.com/notifications/unsubscribe-auth/AAGF4LZIIN4XSE3PYOCMD6DXVJLFHANCNFSM6AAAAAA232ZE6Y>.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/CDLUC3/dmptool/issues/497#issuecomment-1677726240, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHT6WYDTCWCBAWXFEE2UGXDXVJLWPANCNFSM6AAAAAA232ZE6Y . You are receiving this because you were mentioned.Message ID: @.***>

-- Flavio Castro de Sousa Técnico em Tecnologia da Informação Superintendência de Tecnologia da Informação UNIFESP - Reitoria Rua Sena Madureira, 1500 – 4º andar Voip 8581

marisastrong commented 11 months ago

You may want to provide a link to your code along with your error to the ORCID API users group for assistance.

https://groups.google.com/g/orcid-api-users?pli=1

fcsousaunifesp commented 11 months ago

Bom dia.

Quando minha aplicação acessa a seguinte URL :

https://orcid.org/oauth/authorize?client_id=APP-GRJ2W5WDSXZTBVM8&redirect_uri=https:%2F%2Fpgd.ibict.br%2Fusers%2Fauth%2Forcid%2Fcallback&response_type=code&scope=%2Fauthenticate&show_login=true&state=df2b22c857d989b9ba276677c6097db373a7295fe2a2f010

recebo a seguinte mensagem:

[image: erro_orcid_produção_pgdBR.png]

Atenciosamente

Flavio Castro de Sousa

Em seg., 14 de ago. de 2023 às 15:43, marisa strong < @.***> escreveu:

You may want to provide a link to your code along with your error to the ORCID API users group for assistance.

https://groups.google.com/g/orcid-api-users?pli=1

— Reply to this email directly, view it on GitHub https://github.com/CDLUC3/dmptool/issues/497#issuecomment-1677879838, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHT6WYCSPPT7EVYX5MPJCULXVJWTNANCNFSM6AAAAAA232ZE6Y . You are receiving this because you were mentioned.Message ID: @.***>

-- Flavio Castro de Sousa Técnico em Tecnologia da Informação Superintendência de Tecnologia da Informação UNIFESP - Reitoria Rua Sena Madureira, 1500 – 4º andar Voip 8581

fcsousaunifesp commented 11 months ago

Hi Brian.

I made the settings referring to the ORCID member, I made some corrections in the devise.rb file, in relation to the scope.

But now I get this error :

[image: image.png]

Any guidance in this case?

Best Regards

Flavio Castro de Sousa

Em sex., 28 de jul. de 2023 às 16:13, Brian Riley @.***> escreveu:

Hey @fcsousaunifesp https://github.com/fcsousaunifesp in order for that to work you need to be an ORCID member.

If not you should be able to justest the enable_orcid_publication in the config/dmproadmap.yml` file to false.

If you are, you need to make sure that your ORCID credentials are in your Rails credentials file or overridden with an ENV variable or.env file depending on how you have your Rails config working.

If using the credentials file you need to define:

dmproadmap: orcid_client_id: [Your ID] orcid_client_secret: [Your secret] orcid_sandbox: [true or false depending on whether you're in prod or not]

For ENV variables use:

DMPROADMAP_ORCID_CLIENT_ID=[Your ID] DMPROADMAP_ORCID_CLIENT_SECRET=[Your secret] DMPROADMAP_ORCID_SANDBOX=[true or false depending on whether you're in prod or not]

If it is working successfully, it will store the user's access token from ORCID in the external_api_access_tokens table.

— Reply to this email directly, view it on GitHub https://github.com/CDLUC3/dmptool/issues/497#issuecomment-1656202077, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHT6WYG2DQHGTO5T7JXZFCTXSQFNDANCNFSM6AAAAAA232ZE6Y . You are receiving this because you were mentioned.Message ID: @.***>

-- Flavio Castro de Sousa Técnico em Tecnologia da Informação Superintendência de Tecnologia da Informação UNIFESP - Reitoria Rua Sena Madureira, 1500 – 4º andar Voip 8581

briri commented 11 months ago

Hey Flavio. The image is not attached. I think you need to update the GitHub ticket directly.

fcsousaunifesp commented 11 months ago

here is the image error_orcid_16-08-2023

briri commented 11 months ago

Hmm. I'm not sure where you are in the workflow. Is this happening on the user's 3rd party application page (where they login and authorize with ORCID) or is this happening when the user tries to register a new DMP ID with DataCite?

briri commented 11 months ago

and does your config/initializers/devise.rb ORCID section contain: scope: '/authenticate /activities/update',?

fcsousaunifesp commented 11 months ago

Hi This is my devise.rb error_orcid_16-08-2023_01

briri commented 11 months ago

There are 2 parts to the workflow. The authorization part happens when the user goes to 3rd party applications page and connects their ORCID account to your application:

Screenshot 2023-08-18 at 2 22 27 PM

If that part is successful, the user's ORCID access token is written to the external_api_access_tokens table for later use.

The 2nd part is when the user tries to register their DMP ID. In your case, that happens with DataCite. After the call is made to DataCite, the system tries to add the DMP's citation to the user's ORCID record in the works section:

Screenshot 2023-08-18 at 2 27 07 PM

To write that information to the ORCID record, the system uses the user's access_token and the /activities/update grant type.

Which part are you seeing the error from? The 1st or 2nd?

fcsousaunifesp commented 11 months ago

Hi I verified that both my works space in ORCID, as well as the external_api_access_token table are zeroed.

error_orcid_16-08-2023_02

error_orcid_16-08-2023_03

fcsousaunifesp commented 11 months ago

I also noticed that the application is not providing a DOI, even though I have configured the factory DOI credentials.

fcsousaunifesp commented 11 months ago

I will work these next two days to correct these items. DOI and ORCID.

briri commented 11 months ago

I'm confused now.

Let's eliminate the ORCID part and make sure you are getting DOIs from DataCite. Can you please try commenting out these 2 lines https://github.com/CDLUC3/dmptool/blob/50807bf43efddae5f5c1ef6d3dbe989d8a514809/app/controllers/plans_controller.rb#L441 https://github.com/CDLUC3/dmptool/blob/50807bf43efddae5f5c1ef6d3dbe989d8a514809/app/controllers/plans_controller.rb#L446

Then try to register the plan. Let's see if you get a DOI.

briri commented 11 months ago

You can use this query to see the DataCite DOIs that have been created:

select plans.id, plans.title, identifiers.value, identifiers.created_at
from plans inner join identifiers on plans.id = identifiers.identifiable_id and identifiers.identifiable_type = 'Plan'
where identifiers.identifier_scheme_id = (select id from identifier_schemes where name = 'datacite')
order by identifiers.created_at desc;
briri commented 11 months ago

If the DOIs are working, then you can look here for the code that tries to update the user's ORCID record: https://github.com/CDLUC3/dmptool/blob/v4.0.9/app/services/external_apis/orcid_service.rb

It uses the token that gets stored in the external_api_access_tokens table. I would add some debug around the http_post line. Pay careful attention to the headers to make sure they are correct.

fcsousaunifesp commented 11 months ago

I changed enable_orcid_publication: to false And when I try to publish, I get this error. error_doi_18-08-2023_00

and this log

error_doi_18-08-2023

briri commented 11 months ago

Then there’s probably a bug somewhere else in the code that is looking for that enable_orcid_publication flag.

Try to just comment out those two lines I mentioned above instead of changing the flag.

fcsousaunifesp commented 11 months ago

perfect I will test, and check the bugs

fcsousaunifesp commented 10 months ago

Hi, team.

Now after reviewing all entries in ORCID configuration files, I get this error. How can I solve?

(orcid) Authentication failure! invalid_credentials: OAuth2::Error, invalid_client: Client not found: APP-[App id] {"error":"invalid_client","error_description":"Client not found: APP-[App id]"} Processing by Users::OmniauthCallbacksController#failure as HTML Parameters: {"code"=>"[FILTERED]", "state"=>"ae182aa01d46035250e643f2f1a61ea1d14e94f6f558e737"} OmniauthCallbacksController - FAILURE for orcid Redirected to https://pgd.ibict.br/ Completed 302 Found in 5ms (ActiveRecord: 0.0ms | Allocations: 1460)

Best Regards

Flavio Castro de Sousa

briri commented 10 months ago

Hi @fcsousaunifesp

That message is an error from ORCID. ORCID has 2 systems, production and a sandbox/test environment. Make sure you are using the correct Client credentials for the environment.

If you appear to be using the correct client credentials, you will need to contact ORCID to find out why there is a problem.