Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to implement the disconnection from my application from Jawbone UP? #30

Closed
dkpetkova opened this issue Oct 7, 2014 · 0 comments
Closed

Comments

@dkpetkova
Copy link

In order to see my application in the Jawbone UP application feed I have to implement the two-way disconnection mechanism to notify Jawbone when a user disconnects from my app and to receive notifications when a user disconnects from the UP app (http://jawbone.com/up/developer/disconnection):

  1. User disconnects via your application: Make the OAuth call below to notify Jawbone. The access token used for the call will be invalidated. A Pub Sub notification will be sent to verify that the disconnection notice has been received.
  2. User disconnects from Jawbone: Jawbone will notify you via Pub Sub notification as detailed under our Pub Sub section.

I had implemented the first step like that :

                 // disconnect 
                 UPURLRequest *request = [UPURLRequest deleteRequestWithEndpoint:@"/nudge/api/users/@me/PartnerAppMembership" params:nil];

                 [[UPPlatform sharedPlatform] sendRequest:request
                                               completion:^(UPURLRequest *request, UPURLResponse *response,                  NSError *error) {
                                                   // The resulting response.data is an NSDictionary with the JSON results.
                                               }];
                 // log out
                  [UPPlatform sharedPlatform].enableNetworkLogging = NO;
                  [[UPPlatform sharedPlatform] endCurrentSession];

For the second step I think I need some service in my side ( some url). I have to put in the description of my application at http://jawbone.com/up/developer/apps/. Then I have to make some requests with :

         NSString *myURL = @"myUrl.com/userId&sessionToken";
         NSString *requestString = [NSString stringWithFormat:@"/nudge/api/v.1.1/users/@me/pubsub?webhook=%@", myURL];

         UPURLRequest *request = [UPURLRequest postRequestWithEndpoint:requestString
         params:nil];

         [[UPPlatform sharedPlatform] sendRequest:request
         completion:^(UPURLRequest *request, UPURLResponse *response, NSError *error) {
         // The resulting response.data is an NSDictionary with the JSON results.
         }];

After that every time the UP user disconnects from my application, my service with myURL will receive some webhook notification. After that my service will send me notification or will invalidate the user token.

Is this the right way that I have to implement. And can you help me with some piece of code? I looked at the example projects but there is no implementation of what I need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants