0

I am building a HTML5 application in SCP, using Portal Service to manage roles. Back-end developer asked me to give them role info (ID or e-mail) as an input of an interface (They need this authentication info). How to get it?

Is there any front-end API provided to get these info?

Boghyon Hoffmann
  • 17,103
  • 12
  • 72
  • 170
Tina Chen
  • 2,010
  • 5
  • 41
  • 73

1 Answers1

1

User API provides few details about user in HCP. To use the user API in your HTML5 application, add a route to your neo-app.json application descriptor file as follows:

"routes": [
   {
     "path": "/services/userapi", //application path to be forwarded
     "target": {
       "type": "service",
       "name": "userapi"
     }
  }
]

A sample URL for the route defined above would look like this: /services/userapi/currentUser.

An example response could return the following user data:

{
  "name": "p12345678",
  "firstName": "Jon",
  "lastName": "Snow",
  "email": "jon.snow@tina.com",
  "displayName": "Jon Snow (p12345678)"
}

More info here

Sunil B N
  • 4,159
  • 1
  • 31
  • 52
  • Hi, Sunil, can I get this info in FLP of cloud foundry? Should I add this route in `xs-app.json` since there is no neo-app.json in cloud foundry ? – Tina Chen Nov 21 '17 at 04:03
  • Hi Tina, I am not sure. I don't have knowledge of cloud foundry. – Sunil B N Nov 21 '17 at 07:55