Skip to Content
Technical Articles
Author's profile photo Marc Huber

Getting BTP user information in AppGyver

Introduction

Are you using the BTP Authentication feature in your AppGyver app and you want to know who is using the application?

In this guide I will explain quickly how to get the logged-in user information as email, first name or last name.

Steps

  1. Create a REST API data source
  2. Define a data variable
  3. Display user data

 

  1. Create a REST API data source

Go to the DATA tab and create an AppGyver classic data entity ->  REST API direct integration.

Call the data source userApi

AppGyver%20classic%20data%20entity%20-%20REST%20API

AppGyver classic data entity – REST API

Set the settings to:

Resource ID: userAPI

Resource URL: user-api/currentUser

BASE userApi

 

Define the GET RECORD (GET) without an URL Placeholder and remove the /{id} from the Relative path.

get%20Record%20%28GET%29

get Record (GET)

Go to the SCHEMA Tab and create the following schema by clicking ADD Property.

You need displayName, email, firstname, lastname, name all type of text. Additionally you need scopes as list of texts.Add%20schema%20properties

Add schema properties

 

          2. Define a data variable

Add a new data variable for the userAPI as data variable type “Single data record” and modify the logic that it just get the records and set the data variable. Remove the delay part.

data%20variable%20userApi

data variable userApi

         3. Display the user information

Now you can use the data variable userApi to display the logged-in user information.

Bind%20text%20field%20to%20data%20variable

Bind text field to data variable

 

Final result

Assigned Tags

      6 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Daniel Wroblewski
      Daniel Wroblewski

      This is nice ... thanks for adding ... works like a charm

      Author's profile photo Daniel Wroblewski
      Daniel Wroblewski

      What is scopes for? I didn't get anything returned.

      Author's profile photo Marc Huber
      Marc Huber
      Blog Post Author

      I found this in the documentation of the api. Scopes are related to the permissions a user needs to access a resource. This property holds the required scopes to access the target path. Access is granted if the user has at least one of the listed scopes. Note: Scopes are defined as part of the xsuaa service instance configuration. You can use ias as authenticationType and xsuaa scopes for authorization if the application router is bound to both (ias and xsuaa)."

      Author's profile photo Aruljothi Arumugam
      Aruljothi Arumugam

      Hi Marc,

      We spoke about this as a limitation early this month during the BTP workshop but delighted to see it no more a limitation. I will try this and let you know.

       

      Regards,

      Aruljothi Arumugam

      Author's profile photo Boo Siong Khoo
      Boo Siong Khoo

      Hi,

       

      I am having issue retrieving BTP user information after the app has been deployed to appgyverapp.black or BTP. user-api path shows Error 404 not found if I launch it from appgyverapp.black domain or BTP as HTML5 Application.

       

      Thanks.

      Author's profile photo Marc Huber
      Marc Huber
      Blog Post Author

      Hi Boo Siong Khoo ,

       

      can you try to use as a Resource URL: user-api/currentUser without the "/" before user-api.

      I just updated the blog to it.

       

      Best regards,

      Marc