We use proprietary and third party´s cookies to improve your experience and our services, identifying your Internet Browsing preferences on our website; develop analytic activities and display advertising based on your preferences. If you keep browsing, you accept its use. You can get more information on our Cookie Policy
Cookies Policy
Ask Your Question
0

How to Authenticate the user with KeyRock?

asked 2015-08-03 04:45:18 +0200

Milos.Vranic gravatar image

We are trying to authenticate a test user in our web app. We tried to use the implicit grant type using JavaScript, but realised that this is not possible in KeyRock. The other two options (Authorization Code Grant and the Resource Owner Password Credentials Grant) dont have support for JavaScript.

Could someone please recommend the best choice (along with a suitable framework)? An example would also come in handy. The only information we have from KeyRock (while registering the application) is the clientID and the client secret, how do we use those two along with the keyrcok endpoint?

edit retag flag offensive close merge delete

2 answers

Sort by » oldest newest most voted
0

answered 2015-08-05 06:45:36 +0200

albertinisg gravatar image

updated 2015-08-05 06:50:19 +0200

Hi Milos!

First of all I'll assume that your issue is retrieving the Authorization token. We've tested several ways Authorization Code Grand and Owner Password Credentials Grant on Javascript and it worked.

For the first one, here you have a simple example on how to retrieve it (redirect needed).

For the second one, here's an example of how we've used it in our application.

We also made a simple script in bash to retrieve a fresh token (just replace CLIENT_SECRET, CLIENT_ID and the HOST in the REQUEST)

Finally, and based on the first example, we've made an auth.js that works following the Authorization Code Grant type.

Regarding the ClientID and Client Secret, those are the ones that build the header Authorization: Basic. This header is a must in every request you make against KeyRock.

Hints: make sure you configure properly the URL of your application and the callback URL at KeyRock and at your application; and also, that the header Authorization: Basic XXXXXXXXXXXXXXXXXXX is there and with the base64 encoding.

Hope is clear enough, but let me know if you have any doubts :)

edit flag offensive delete link more

Comments

Thank you for your answer, I will inform you of my results as soon as I test this out.

Milos.Vranic gravatar imageMilos.Vranic ( 2015-08-06 03:23:43 +0200 )edit

What is target URL of your API requests? I can only see the end of the path but not the base of that path.

Milos.Vranic gravatar imageMilos.Vranic ( 2015-08-07 02:02:01 +0200 )edit

The target URL you should use for KeyRock is 'account.lab.fiware.org'. In some of the examples provided probably we use just 'idm', but this is just because we've installed our own KeyRock for testing purposes.

albertinisg gravatar imagealbertinisg ( 2015-08-07 09:13:02 +0200 )edit

Hi again Milos! Could you finally authenticate following any of the examples? :)

albertinisg gravatar imagealbertinisg ( 2015-08-11 06:06:37 +0200 )edit
Milos.Vranic gravatar imageMilos.Vranic ( 2015-08-13 06:38:55 +0200 )edit
0

answered 2015-08-17 11:42:21 +0200

Since KeyRock is using Oauth2 standard any example for connecting to services like tweeter will works. Just change the end point address and the other login details.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

2 followers

Stats

Asked: 2015-08-03 04:45:18 +0200

Seen: 11,707 times

Last updated: Aug 17 '15