From: Krzysztof B. <kb...@un...> - 2018-02-26 23:06:16
|
Hi Nikolaos, W dniu 23.02.2018 o 20:52, Nikolaos Evangelou pisze: > Hello everybody, > > I have 3 questions. First, is it possible to reproduce the > registration flow, when a user is logging in using an IdP, using API > calls? For example, can I register to B2ACCESS with my ORCID account > but using the API and not the web GUI? Fully reproducing is impossible and would be super hard anyway. But you can mostly reproduce the effects of successful registration of ORCID person using the REST API. You need to know how Unity is configured to act in such case: how the ORCID profile is translated to the local representation: input translation profile, registration form if any, its automation. And of course contents of your ORCID profile. Then you can invoke operations to add identity (likely it will be of identifier type with value equal to ORCID id), add attributes and most likely this will be it. There will be slight differences though: in Unity it will be visible that attributes and identity were directly defined and not obtained from orcid. > Second, I tried to make a put request to add an attribute to an entity > as is shown in this guide > http://www.unity-idm.eu/documentation/unity-2.2.0/rest-api-v1.html#_set_attribute > <http://www.unity-idm.eu/documentation/unity-2.2.0/rest-api-v1.html#_set_attribute> , > but when I pass the data I get the response “No JSON object could be > decoded”. I run this command: > ``` > curl -v -u ‘username’:'password' -H 'Content-Type: application/json' > -d '{"values": ["{\"value\":\"so...@em... > <mailto:so...@em...>\",\"tags\":[]}"],"name": "email","groupPath": > "/ROOT"}' -X PUT > 'https://unity.eudat-aai.fz-juelich.de/rest-admin/v1/entity/ > <https://unity.eudat-aai.fz-juelich.de/rest-admin/v1/entity/>{entityid}/attribute?identityType=email' > | python -m json.tool > ``` > So, how should be the format of the json data? The email value is incorrect. As you can see in the cited doc example, you are missing the confirmationData part. Something like this (only the value): "{\"value\":\"so...@em...\",\"confirmationData\":{\"confirmed\":false,\"confirmationDate\":0,\"sentRequestAmount\":0},\"tags\":[]}" > And third, what parameters should I pass to > https://unity.eudat-aai.fz-juelich.de/oauth2/token > <https://unity.eudat-aai.fz-juelich.de/oauth2/token> endpoint to get > an access token after registration? Hard to say, depends on OAuth flow you want to use and which is enabled for you client. In general please refer to the OAuth2 protocol spec. Best, Krzysztof |