You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Sources/Auth/AuthClient.swift
+55-2Lines changed: 55 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -955,14 +955,67 @@ public final class AuthClient: Sendable {
955
955
tryawaituser().identities ??[]
956
956
}
957
957
958
+
/// Links an OAuth identity to an existing user.
959
+
///
960
+
/// This method supports the PKCE flow.
961
+
///
962
+
/// - Parameters:
963
+
/// - provider: The provider you want to link the user with.
964
+
/// - scopes: A space-separated list of scopes granted to the OAuth application.
965
+
/// - redirectTo: A URL to send the user to after they are confirmed.
966
+
/// - queryParams: Additional query parameters to use.
967
+
/// - launchURL: Custom launch URL logic.
968
+
publicfunc linkIdentity(
969
+
provider:Provider,
970
+
scopes:String?=nil,
971
+
redirectTo:URL?=nil,
972
+
queryParams:[(name:String, value:String?)]=[],
973
+
launchURL:@MainActor(_ url:URL)->Void
974
+
)asyncthrows{
975
+
letresponse=tryawaitgetLinkIdentityURL(
976
+
provider: provider,
977
+
scopes: scopes,
978
+
redirectTo: redirectTo,
979
+
queryParams: queryParams
980
+
)
981
+
982
+
awaitlaunchURL(response.url)
983
+
}
984
+
985
+
/// Links an OAuth identity to an existing user.
986
+
///
987
+
/// This method supports the PKCE flow.
988
+
///
989
+
/// - Parameters:
990
+
/// - provider: The provider you want to link the user with.
991
+
/// - scopes: A space-separated list of scopes granted to the OAuth application.
992
+
/// - redirectTo: A URL to send the user to after they are confirmed.
993
+
/// - queryParams: Additional query parameters to use.
994
+
///
995
+
/// - Note: This method opens the URL using the default URL opening mechanism for the platform, if you with to provide your own URL opening logic use ``linkIdentity(provider:scopes:redirectTo:queryParams:launchURL:)``.
996
+
publicfunc linkIdentity(
997
+
provider:Provider,
998
+
scopes:String?=nil,
999
+
redirectTo:URL?=nil,
1000
+
queryParams:[(name:String, value:String?)]=[]
1001
+
)asyncthrows{
1002
+
tryawaitlinkIdentity(
1003
+
provider: provider,
1004
+
scopes: scopes,
1005
+
redirectTo: redirectTo,
1006
+
queryParams: queryParams,
1007
+
launchURL:{URLOpener.open($0)}
1008
+
)
1009
+
}
1010
+
958
1011
/// Returns the URL to link the user's identity with an OAuth provider.
959
1012
///
960
1013
/// This method supports the PKCE flow.
961
1014
///
962
1015
/// - Parameters:
963
1016
/// - provider: The provider you want to link the user with.
964
-
/// - scopes: The scopes to request from the OAuth provider.
965
-
/// - redirectTo: The redirect URL to use, specify a configured deep link.
1017
+
/// - scopes: A space-separated list of scopes granted to the OAuth application.
1018
+
/// - redirectTo: A URL to send the user to after they are confirmed.
966
1019
/// - queryParams: Additional query parameters to use.
0 commit comments