# Automate Management API Tokens: POST Objective-C not receiving token in response

**URL:** <https://community.auth0.com/t/automate-management-api-tokens-post-objective-c-not-receiving-token-in-response/7367>\
**Category:** Get Help\
**Tags:** oauth, objective-c, management-api, ios\
**Created:** [July 3, 2017, 11:25am UTC](https://community.auth0.com/t/automate-management-api-tokens-post-objective-c-not-receiving-token-in-response/7367 "2017-07-03T11:25:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sandy](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@sandy](https://community.auth0.com/u/sandy)\
**Post date:** [July 3, 2017, 11:25am UTC](https://community.auth0.com/t/automate-management-api-tokens-post-objective-c-not-receiving-token-in-response/7367/1 "2017-07-03T11:25:20Z")

</div>

In Advanced Rest Client, I can get a response that contains the management authorization token. But, when I do this in Objective-C code following this documentation: [Management API Access Tokens - Auth0 Docs](https://auth0.com/docs/api/management/v2/tokens#automate-the-process)

It doesn’t return the data.

The only headers I get are the following in the response:

Headers: {  
“Cache-Control” = “no-cache”;  
“Content-Type” = “application/json”;  
Date = “Mon, 03 Jul 2017 04:23:02 GMT”;  
Pragma = “no-cache”;  
“Strict-Transport-Security” = “max-age=15724800”;  
“x-auth0-requestid” = 783511679899232996fc;  
“x-ratelimit-limit” = 1000000;  
“x-ratelimit-remaining” = 999999;  
“x-ratelimit-reset” = 1499055783;  
“x-robots-tag” = “noindex, nofollow, nosnippet, noarchive”;  
}

And the status code is 200.  
Any ideas?

---

<div class="post-metadata">

**Author:** ![sandy](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@sandy](https://community.auth0.com/u/sandy)\
**Post date:** [July 3, 2017, 11:33am UTC](https://community.auth0.com/t/automate-management-api-tokens-post-objective-c-not-receiving-token-in-response/7367/2 "2017-07-03T11:33:32Z")

</div>

Okay, so I figured this out.  
The documentation on this page: [Management API Access Tokens](https://auth0.com/docs/api/management/v2/tokens#automate-the-process) needs to be updated.

For objective-c, this data is returned in the NSData \*data object and needs to be converted to an NSDictionary to get the results. It is NOT in the response object that is returned.

You can convert it like this:

```
NSDictionary* json = [NSJSONSerialization JSONObjectWithData:data
                                                                                                             options:kNilOptions
                                                                                                               error:&error];

```

---

<div class="post-metadata">

**Author:** ![sandy](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@sandy](https://community.auth0.com/u/sandy)\
**Post date:** [July 4, 2017, 12:20am UTC](https://community.auth0.com/t/automate-management-api-tokens-post-objective-c-not-receiving-token-in-response/7367/3 "2017-07-04T00:20:42Z")

</div>

OK, I have another issue now.  
After I am able to get the token and I try to update the metadata, it says:

error = Forbidden;  
errorCode = “unowned\_resource”;  
message = “User to be acted on does not match subject in bearer token.”;  
statusCode = 403;

I honestly at this point do NOT understand what is going on.

If I take the token that is in the API Explorer tab, that works and it updates fine. But, when I retrieve a token automatically – the token it gives me says that it is forbidden.

---

<div class="post-metadata">

**Author:** ![sandy](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@sandy](https://community.auth0.com/u/sandy)\
**Post date:** [July 4, 2017, 12:20am UTC](https://community.auth0.com/t/automate-management-api-tokens-post-objective-c-not-receiving-token-in-response/7367/4 "2017-07-04T00:20:57Z")

</div>

@prashant Any ideas?? How exactly do I get the token? I am following the documentation from the link on this post.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [March 2, 2018, 5:55am UTC](https://community.auth0.com/t/automate-management-api-tokens-post-objective-c-not-receiving-token-in-response/7367/5 "2018-03-02T05:55:08Z")

</div>


