Closed emersonku closed 9 years ago
You need to get your NXOAuth2Account
from NXOAuth2AccountStore
. It has an accessToken
property. Be sure to observe token refresh using the notifications.
The NXOAuth2Client
(if you are using the low level way, which is not recommended) also has a accessToken
property.
Thanks Toto. I have two questions:
<NXOAuth2Token token:CecfrU9qrprJjpYdvCBcCUKWOKJQshIWlUKqEHdz refreshToken:(null) expiresAt:2015-05-12 07:45:44 +0000 tokenType: Bearer>
Thank you very much!
Sorry above are three questions not two ^_^
I think I got the answers, please please confirm if I'm wrong:
And please bear with me for these questions: 1) I encounter the problem of using responseBody ( [[account accessToken]responseBody]) in accessing resources (by setting HTTPClient header). I know the format of the responseBody is IETF compliant, however my backend just rejected it (I'm using lucadegasperi/oauth2-server-laravel). Status code 401, message is "The resource owner or authorization server denied the request". Any idea?
2) How can I observe the token refresh notification? I can't find it in the documentation... or please direct me to it if I'm missing it
3) Is it a manual process to check the expiry date of access token and then send the refresh token if it is expired? I know it's all auto if I'm using the built in resources request method. But since I'm using Restkit for that case it does not seem trivial to me anymore.
Thanks
I have sorted out all questions above except No. 2.
Question: How can I observe the token refresh notification? I can't find it in the documentation... or please direct me to it if I'm missing it
Please help...
Hi I have successfully got access token by using user password grant with NXOAuth2Client. Now I want to retrieve this access token because all my code has been developed to use Restkit to retrieve resources. I need to use this access token so that my Restkit codes can retrieve resources:
[sharedManager.HTTPClient setDefaultHeader:accessToken];
Any idea would be appreciated...