Thursday, July 18, 2013

How to get a user profile for OAuth Token using JWT headers

In this blog post lets discuss how you can retrieve user profile and view attributes of a user using only the OAuth token in WSO2 Identity server. I assume that reader is familiar with WSO2 identity server and if you need more help you can follow the documentation at

1) Change the CARBON_HOME/repository/conf/identity.xml and make following attribute true. Then start the WSO2 Identity server.


2) Get the oauth Token ( you need to get the base64 encoded value for (client id:client secret) value.

You can use an online service for encoding such as and then issue following CURL command to obtain the access token. (make sure you have the correct port in the server URL)

curl -v -X POST -H "Authorization: Basic VE01enNFem9FZG9NRERjVEJjbXRBcWJGdTBFYTpYUU9URExINlBBOHJvUHJfSktrTHhUSTNseGNh" -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" -k -d "grant_type=password&username=admin&password=admin" https://localhost:9443/oauth2endpoints/token

 3) Now you need to invoke and admin service in the Identity server. Please follow on how to invoke admin services using SOAP UI.

We shall now invoke the following service.



Now you will be getting the authorization context token which is encoded in base64 and delimited with "." values. Middle part will contain the user profile value and we can get it decoded using


Following is the output of the decoded value which has the user profile details of the user who generated the OAuth access token.


  1. Is it possible for WSO2 IS to generate the JWT as the access token? Because then we can avoid another round trip to the WSO2 IS for token validation...

  2. As asked by squanderer, I would be interested in getting back directly the JWT.
    Did anyonme manage to do it ?

  3. Thanks for this article.
    As asked by squanderer, and another reader, is it possible to get back directly the JWT ? (in a bearer mode)

  4. Cybersecurity is a bigger picture that shows us that it is crucial to solve that puzzle; rather than finding two-three massive pieces and relying on those to complete the picture. Computer Forensics Analyst Career Overview

  5. While the topic of obtaining a user profile through OAuth Token using JWT headers is outside the scope of "nursing dissertation topics," it is essential to explore relevant themes in nursing research. Areas like patient care, healthcare technologies, nursing education, or mental health interventions offer exciting avenues for nursing dissertation topics, contributing to advancements in the field and enhancing patient outcomes.

  6. To retrieve a user profile using OAuth Token and JWT headers, ensure your application is configured to validate and decode JWT tokens. Extract the user identifier from the decoded token and use it to fetch the corresponding user profile from your user database or the identity provider's API. Implementing proper error handling is crucial for a secure and reliable system. For comprehensive guidance on OAuth token usage and user profile retrieval, consider consulting relevant documentation or seeking argumentative essay help to analyze and present the intricacies of the topic in a structured manner.