Skip to content

Commit

Permalink
Update state parameter name
Browse files Browse the repository at this point in the history
  • Loading branch information
shilgapira committed Dec 16, 2023
1 parent 26bea16 commit 47c6410
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/internal/http/DescopeClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ class DescopeClient: HTTPClient {

struct OAuthNativeStartResponse: JSONResponse {
var clientId: String
var state: String
var stateId: String
var nonce: String
var implicit: Bool
}
Expand All @@ -333,10 +333,10 @@ class DescopeClient: HTTPClient {
])
}

func oauthNativeFinish(provider: OAuthProvider, state: String, user: String?, authorizationCode: String?, identityToken: String?) async throws -> JWTResponse {
func oauthNativeFinish(provider: OAuthProvider, stateId: String, user: String?, authorizationCode: String?, identityToken: String?) async throws -> JWTResponse {
return try await post("auth/oauth/native/finish", body: [
"provider": provider.name,
"state": state,
"stateId": stateId,
"user": user,
"code": authorizationCode,
"idToken": identityToken,
Expand Down
2 changes: 1 addition & 1 deletion src/internal/routes/OAuth.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class OAuth: Route, DescopeOAuth {
let (authorizationCode, identityToken, user) = try parseCredential(authorization.credential, implicit: startResponse.implicit)

log(.info, "Finishing authentication using Sign in with Apple")
return try await client.oauthNativeFinish(provider: provider, state: startResponse.state, user: user, authorizationCode: authorizationCode, identityToken: identityToken).convert()
return try await client.oauthNativeFinish(provider: provider, stateId: startResponse.stateId, user: user, authorizationCode: authorizationCode, identityToken: identityToken).convert()
}

@MainActor
Expand Down
16 changes: 11 additions & 5 deletions src/sdk/Callbacks.swift
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,12 @@ public extension DescopeOAuth {
/// a native dialog that lets the user sign in with the Apple ID they're already
/// using on their device.
///
/// The Sign in with Apple APIs require some setup in your Xcode project, including
/// at the very least adding the `Sign in with Apple` capability. You will also need
/// to configure the Apple provider in the [Descope console](https://app.descope.com/settings/authentication/social).
/// In particular, when using your own account make sure that the `Client ID` value
/// matches the Bundle Identifier of your app.
///
/// - Parameters:
/// - provider: The provider the user wishes to authenticate with, this will usually
/// either be `.apple` or the name of a custom provider that's configured for Apple.
Expand All @@ -504,11 +510,11 @@ public extension DescopeOAuth {
/// - Throws: ``DescopeError/oauthNativeCancelled`` if the authentication view is aborted
/// or cancelled by the user.
///
/// - Note: The Sign in with Apple APIs require some setup in your Xcode project,
/// including at the very least adding the `Sign in with Apple` capability. You will
/// also need to configure the Apple provider in the [Descope console](https://localhost:8080/settings/authentication/social).
/// In particular, when using your own Account make sure that the `Client ID` value
/// matches the Bundle Identifier of your app.
/// - Note: This is an asynchronous operation that performs network requests before and
/// after displaying the modal authentication view. It is thus recommended to show an
/// activity indicator or switch the user interface to a loading state before calling
/// this, otherwise the user might accidentally interact with the app when the
/// authentication view is not being displayed.
///
/// - SeeAlso: For more details about configuring your app and generating client secrets
/// see the [Sign in with Apple documentation](https://developer.apple.com/sign-in-with-apple/get-started/).
Expand Down

0 comments on commit 47c6410

Please sign in to comment.