0

I am new to WSO2 API Manager (APIM) using version 1.9.1. I am referring to link : https://docs.wso2.com/display/AM170/Token+API, in this link they've given curl command

curl -k -d "grant_type=password&username=<username>&password=
<password>&scope=<scope1> <scope2>" -H "Authorization: Basic 
SVpzSWk2SERiQjVlOFZLZFpBblVpX2ZaM2Y4YTpHbTBiSjZvV1Y4ZkM1T1FMTGxDNmpzbEFDVzhh, 
Content-Type: application/x-www-form-urlencoded" https://localhost:8243/token

Now I am trying to understand above curl command in order to create Junit to map all these headers and body values to my Spring RestTemplate API's. I understand all parameters, but I don't understand below

Authorization: Basic 
    SVpzSWk2SERiQjVlOFZLZFpBblVpX2ZaM2Y4YTpHbTBiSjZvV1Y4ZkM1T1FMTGxDNmpzbEFDVzhh

Could you please explain what is the use of it? What we called long hex string by name?

Community
  • 1
  • 1

2 Answers2

1

You have to decode above string(SVpzSWk2SERiQjVlOFZLZFpBblVpX2ZaM2Y4YTpHbTBiSjZvV1Y4ZkM1T1FMTGxDNmpzbEFDVzhh) and decoded string is IZsIi6HDbB5e8VKdZAnUi_fZ3f8a:Gm0bJ6oWV8fC5OQLLlC6jslACW8a

Normally these strings are combined with colon(clientId:clientSecret) and encoded with base64. IZsIi6HDbB5e8VKdZAnUi_fZ3f8a is the client ID and Gm0bJ6oWV8fC5OQLLlC6jslACW8a is the client secret.

Usage of it:- You are trying to take the access token using above curl command. when you use above grant type, you have to provide client id and client secret to get access token.

Madura Harshana
  • 1,299
  • 8
  • 25
  • 40
  • SVpzSWk2SERiQjVlOFZLZFpBblVpX2ZaM2Y4YTpHbTBiSjZvV1Y4ZkM1T1FMTGxDNmpzbEFDVzhh - What we usually call this as UserAuth value ? –  Jan 21 '16 at 08:19
0

As far as i understood (by reading the same doc) that is base64 encoded string

And it also says that it "Combine the consumer key and consumer secret keys in the format consumer-key:consumer-secret and encode the combined string using base64."

You can get more info regarding this on http://base64encode.org and What is base 64 encoding used for?

Community
  • 1
  • 1
Koronå
  • 71
  • 7