Comments (4)
Hmm... you shouldn't really have to get the access token at all. What are you wanting to do with it?
from oauth2client.
will, the server I try to connect has a document said i need the token to get content from service . like this...https://api.weibo.com/2/statuses/public_timeline.json?access_token=abcd
from oauth2client.
Ah, you can make the request through the NXOAuth2 library and it will incorporate the access token into the request for you.
You can either do...
[NXOAuth2Request performMethod:@"GET"
onResource:[NSURL urlWithString:@"https://api.weibo.com/2/statuses/public_timeline.json"]
usingParameters:nil
withAccount: //your account
sendProgressHandler:nil
responseHandler:
^(NSURLResponse *response, NSData *responseData, NSError *error) {
//deal with the request here.
}];
This works asynchronously so does everything in one line of code. By putting the account info in there it adds all the access token stuff for you.
Or you can get a regular NSURLRequest by doing...
NXOAuth2Request *authRequest = [[NXOAuth2Request alloc] initWith ... some stuff that I can't remember off the top of my head];
authRequest.account = your account;
NSURLRequest *signedRequest = [authRequest signedRequest];
Then you can use this signedRequest as normal and it has all the auth stuff in it already.
HTH
Thanks
from oauth2client.
Thanks this really picked me up:)
btw:
I set my redirect uri to MyApp: //
and when I use
[[NXOAuth2AccountStore sharedStore] requestAccessToAccountWithType:@"myFancyService"
withPreparedAuthorizationURLHandler:^(NSURL *preparedURL){
[[NSWorkspace sharedWorkspace] openURL:preparedURL];
}];
it's redirect to the url with the code like:"myapp://connect?code=e72c62b906c62de31d5fefa377bb092a" , what should I do with it?
from oauth2client.
Related Issues (20)
- iOS 9 support? HOT 5
- Crash in accountsFromDefaultKeychain assert HOT 1
- OAuth with UiWebView And SSL HOT 1
- FitBit: Authorization header required HOT 8
- Support iOS 9
- Can OAuth2Client Works with Authorization code grant type? HOT 1
- NXOAuth2Request.performMethod cannot be started on background queue HOT 1
- Custom header fields not applied to token refresh request
- refresh access token failing HOT 1
- NXOAuth2Request with custom headers and JSON Body payload
- New pod release? HOT 2
- it does not work properly for fitbit HOT 1
- Crash in NXOAuth2AccountStore HOT 2
- Integration with ADAL
- Can we use this library in swift App.
- "NXOAuth2Request performMethod" does not refresh token after token expired
- Where is the observer for NXOAuth2AccountDidFailToGetAccessTokenNotification?
- Crash in NXOAuth2AccountStore - didFailToGetAccessTokenWithError
- F HOT 1
- Encountering a Login Error in the Latest Xcode
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from oauth2client.