No Description

FIRDeleteAccountRequest.m 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * Copyright 2017 Google
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import "FIRDeleteAccountRequest.h"
  17. NS_ASSUME_NONNULL_BEGIN
  18. /** @var kCreateAuthURIEndpoint
  19. @brief The "deleteAccount" endpoint.
  20. */
  21. static NSString *const kDeleteAccountEndpoint = @"deleteAccount";
  22. /** @var kIDTokenKey
  23. @brief The key for the "idToken" value in the request. This is actually the STS Access Token,
  24. despite it's confusing (backwards compatiable) parameter name.
  25. */
  26. static NSString *const kIDTokenKey = @"idToken";
  27. /** @var kLocalIDKey
  28. @brief The key for the "localID" value in the request.
  29. */
  30. static NSString *const kLocalIDKey = @"localId";
  31. @implementation FIRDeleteAccountRequest {
  32. /** @var _accessToken
  33. @brief The STS Access Token of the authenticated user.
  34. */
  35. NSString *_accessToken;
  36. /** @var _localID
  37. @brief The localID of the user.
  38. */
  39. NSString *_localID;
  40. }
  41. - (nullable instancetype)initWitLocalID:(NSString *)localID
  42. accessToken:(NSString *)accessToken
  43. requestConfiguration:(FIRAuthRequestConfiguration *)requestConfiguration {
  44. self = [super initWithEndpoint:kDeleteAccountEndpoint requestConfiguration:requestConfiguration];
  45. if (self) {
  46. _localID = [localID copy];
  47. _accessToken = [accessToken copy];
  48. }
  49. return self;
  50. }
  51. - (nullable id)unencodedHTTPRequestBodyWithError:(NSError *_Nullable *_Nullable)error {
  52. NSMutableDictionary *postBody = [NSMutableDictionary dictionary];
  53. postBody[kIDTokenKey] = _accessToken;
  54. postBody[kLocalIDKey] = _localID;
  55. return postBody;
  56. }
  57. @end
  58. NS_ASSUME_NONNULL_END