Cancel
Showing results for 
Search instead for 
Did you mean: 

Having trouble getting Oauth2 working via Postman

Experimenter
Experimenter

I'm trying to follow some of the video tutorials, but they skip over a large amount of info. Ultimately, I'd just like to have my app get credentials and push data to the MindSphere TSDB.

 

I  have an app "helloworld" from the training pushed to MindSphere.

 

Then in the Dev console, I created credentials for the app, which gave me the client id and secret.

image.png

 

Then in Postman I tried to get a new token using those credentials and the URL "[tenant].paim.eu1.mindsphere.io/oauth/token"

(helloworld.all) is the only scope I have set up on the previous screen.

image.png

 

But that didn't work - the credentials are rejected. Can anyone tell me what I'm doing wrong?

2 REPLIES 2
Highlighted

Re: Having trouble getting Oauth2 working via Postman

Siemens Genius Siemens Genius
Siemens Genius

For getting access_token from token manager, you have to send your POST request to:

 

 

https://gateway.eu1.mindsphere.io/api/technicaltokenmanager/v3/oauth/token

 

 

In Headers, you have to add the following:

 

 

X-SPACE-AUTH-KEY: Basic c29sYXJjMDItYXBpY...
Content-Type: application/json

 

 

Where X-SPACE-AUTH-KEY is your client_id:client_secret encoded in Base64. You can convert it from here.

 

In the body, you have to add the following:

 

{
  "appName": "yourAppName",
  "appVersion": "theAppVersion",
  "hostTenant": "yourTenant",
  "userTenant": "yourTenant"
}

An example is shown below:

 

 

{
  "appName": "apiappfordemo",
  "appVersion": "1.0.0",
  "hostTenant": "solarc02",
  "userTenant": "solarc02"
}

With these, you should be able to get the access_token as shown below:

 

tokenManager.png

 

More examples can be found here. Hope this helps.

Re: Having trouble getting Oauth2 working via Postman

Experimenter
Experimenter

Thank you! This was the best explanation I have read so far.