ajonnet

ios code utilizing getSessionToken Coud Code (fVLQr302)

Apr 7th, 2016
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //gUser is the instance of GIDGoogleUser who has successfully signed in
  2.  
  3. NSString *gClientId = [GGLContext sharedInstance].configuration.clientID;
  4.         [PFCloud callFunctionInBackground:@"getSessionToken"
  5.                            withParameters:@{@"idToken":guser.authentication.idToken,
  6.                                             @"GClientId":gClientId}
  7.                                     block:^(NSString *sessionToken, NSError * _Nullable error) {
  8.                                         assert(!error);
  9.                                         assert(sessionToken);
  10.                                         [PFUser becomeInBackground:sessionToken
  11.                                                              block:^(PFUser * _Nullable user, NSError * _Nullable error) {
  12.                                                                  assert(!error);
  13.                                                                  
  14.                                                                  [self.busyIndicator stopAnimating];
  15.                                                                  
  16.                                                                  //Jump to Main Screen
  17.                                                                  [self moveToMainScreen];
  18.                                                              }];
  19.                                     }];
Add Comment
Please, Sign In to add comment