Skip to content

Conversation

@usame-algan
Copy link
Contributor

@usame-algan usame-algan commented Jun 24, 2024

What it solves

  • Adds two new functions getAuthNonce and verifyAuth
  • Adds includeCredentials parameter to get/post/put/delete calls

How to test

  1. Checkout this branch locally and run yarn link
  2. Use the local package in feat: Add method to Sign in with Ethereum [SW-28] safe-wallet-monorepo#3853
  3. Observe the sign in flow still works

@usame-algan usame-algan requested review from jmealy and katspaugh and removed request for katspaugh June 24, 2024 09:46
@usame-algan usame-algan requested a review from katspaugh June 24, 2024 09:58
src/index.ts Outdated
{
body,
},
true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to make the credentials flag part of the endpoint type in api.ts.

src/index.ts Outdated
}

export function getAuthNonce(): Promise<AuthNonce> {
return getEndpoint(baseUrl, '/v1/auth/nonce', { credentials: 'include' }, undefined)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to pass undefined explicitly?

Suggested change
return getEndpoint(baseUrl, '/v1/auth/nonce', { credentials: 'include' }, undefined)
return getEndpoint(baseUrl, '/v1/auth/nonce', { credentials: 'include' })

src/types/api.ts Outdated
post: operations['verify_auth']
parameters: {
path: null
credentials: RequestCredentials
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can only be include, right? The endpoint doesn't make sense w/ a different value.

Suggested change
credentials: RequestCredentials
credentials: 'include'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense!

Copy link
Member

@katspaugh katspaugh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gut diese

@usame-algan usame-algan merged commit ab3419f into main Jun 25, 2024
@usame-algan usame-algan deleted the siwe-auth branch June 25, 2024 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants