ios - get "user_id" along with the AccessToken from Django-Tastypie Server -
My server is a Django-Tastypie REST server that is accessed by an IOS customer I want to implement OAuth2 for authentication I am I am currently using this: And on the client side, I'm using AFNETWorking 2.0 AFHTTPRequestOperationManager to handle requests and feedback. I'm following the tutorial (which I have updated to work with 2.0) Now, after the tutorial, everything works well, I'm getting "access_token" for a user, For which I can pass an HTTPRequest with values in my code with CLIENT_ID, CLIENT_SECRET, username and password.
is:
{"access_token": "your-access-token>", "scope": "read", "expires_in": 8639 9, "refresh_token": "Your now tutorial works great, but it is shown next to that the author also receives the " user_id "
field with the response to the above areas and then It stores "access_token"
and "user_id"
in the iOS customer, and then to retrieve a resource from the server, that "authorization" field and A custom HTTPReq with "access_token"
Uest creates a header and sends it in a URL that he creates using "user_id"
which he had saved. Now, my problem is that I am everywhere There was no way to find and receive "user_id"
in that response. If I do not know "user_id" then how can I create a request URL to fetch resources (like in the tutorial)? Or how do I identify resources to use only "access_token"?
To not use "username" to identify these resources, I (which I previously received "login_token" Had entered) was very dumb. I changed the resource api lookup to use "username" in the URL instead of "user_id" and it worked perfectly!
Comments
Post a Comment