Skip to content
This repository was archived by the owner on Sep 15, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Sources/WordPressKit/Services/AccountServiceRemoteREST.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,21 @@ extern MagicLinkFlow const MagicLinkFlowSignup;

@interface AccountServiceRemoteREST : ServiceRemoteWordPressComREST <AccountServiceRemote>

/**
* @brief Request an authentication link be sent to the email address provided.
*
* @param success The block that will be executed on success. Can be nil.
* @param failure The block that will be executed on failure. Can be nil.
*/
- (void)requestWPComAuthLinkForEmail:(NSString *)email
clientID:(NSString *)clientID
clientSecret:(NSString *)clientSecret
source:(MagicLinkSource)source
wpcomScheme:(NSString *)scheme
createAccountIfNotFound:(BOOL)createAccountIfNotFound
success:(void (^)(void))success
failure:(void (^)(NSError *error))failure;

/**
* @brief Request an authentication link be sent to the email address provided.
*
Expand Down
26 changes: 23 additions & 3 deletions Sources/WordPressKit/Services/AccountServiceRemoteREST.m
Original file line number Diff line number Diff line change
Expand Up @@ -245,17 +245,19 @@ - (void)requestWPComAuthLinkForEmail:(NSString *)email
clientSecret:(NSString *)clientSecret
source:(MagicLinkSource)source
wpcomScheme:(NSString *)scheme
createAccountIfNotFound:(BOOL)createAccountIfNotFound
success:(void (^)(void))success
failure:(void (^)(NSError *error))failure
{
NSString *path = [self pathForEndpoint:@"auth/send-login-email"
withVersion:WordPressComRESTAPIVersion_1_3];

NSDictionary *extraParams = @{
MagicLinkParameterFlow: MagicLinkFlowLogin,
MagicLinkParameterSource: source
MagicLinkParameterSource: source,
@"create_account": createAccountIfNotFound ? @"true" : @"false"
};

[self requestWPComMagicLinkForEmail:email
path:path
clientID:clientID
Expand All @@ -266,6 +268,24 @@ - (void)requestWPComAuthLinkForEmail:(NSString *)email
failure:failure];
}

- (void)requestWPComAuthLinkForEmail:(NSString *)email
clientID:(NSString *)clientID
clientSecret:(NSString *)clientSecret
source:(MagicLinkSource)source
wpcomScheme:(NSString *)scheme
success:(void (^)(void))success
failure:(void (^)(NSError *error))failure
{
[self requestWPComAuthLinkForEmail:email
clientID:clientID
clientSecret:clientSecret
source:source
wpcomScheme:scheme
createAccountIfNotFound:NO
success:success
failure:failure];
}

- (void)requestWPComSignupLinkForEmail:(NSString *)email
clientID:(NSString *)clientID
clientSecret:(NSString *)clientSecret
Expand Down