mapmyindia confused about how to get OAuth

1k Views Asked by At

I have read the documentation for OAuth on this website.

But I am still confused about the format in which the request url is supposed to be in.

Any help would be amazing.

2

There are 2 best solutions below

0
Vaibhav On

You may use the following request url to generate the Access Token,

String URL = "https://outpost.mapmyindia.com/api/security/oauth/token?grant_type=client_credentials&client_id="+clientid+"&client_secret="+clientsecret;

And, add the following Headers in the POST Method,

("accept", "application/json")

("Content-Type", "application/x-www-form-urlencoded")

If you are using Volley Library to get the Access Token using the POST request, you may pass the parameters as a HashMap as follows:

Map<String, String> params = new HashMap<String, String>();
            params.put("accept", "application/json");
            params.put("Content-Type", "application/x-www-form-urlencoded");
0
Yaroslav On

It looks like they use Spring. And it requires grant_type to be passed as application/x-www-form-urlencoded. And the credentials in a header:

{
  'Authorization': `Basic ${base64Encode(clientId:clientSecret)}`,
}