Skip to content

Commit

Permalink
chore: moving some of the change to the rest layer instead of graphql
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Burtey committed Sep 11, 2023
1 parent 196c706 commit 7ccd2e0
Show file tree
Hide file tree
Showing 10 changed files with 8 additions and 23 deletions.
1 change: 0 additions & 1 deletion dev/apollo-federation/supergraph.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ type AuthTokenPayload
{
authToken: AuthToken
errors: [Error!]!
id: ID!
totpRequired: Boolean
}

Expand Down
10 changes: 0 additions & 10 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ services:
- lnd-outside-1
- svix
- lnd-outside-2
- otel-agent
- mailslurper
- hydra
#! - consent
restart: on-failure:10
integration-deps:
image: busybox
Expand Down Expand Up @@ -452,13 +449,6 @@ services:
restart: on-failure
depends_on:
- postgresdhydra
#! consent:
#! environment:
#! - HYDRA_ADMIN_URL=http://hydra:4445
#! image: oryd/hydra-login-consent-node:v2.1.2
#! ports:
#! - "3000:3000"
#! restart: unless-stopped
postgresdhydra:
image: postgres:14.1
environment:
Expand Down
4 changes: 2 additions & 2 deletions docs/hydra.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ hydra-login-consent-node % yarn start

On console 2:
```sh
galoy % make start-deps
galoy % make start
```

On console 3:
Expand All @@ -46,7 +46,7 @@ code_client=$(hydra create client \
--grant-type authorization_code,refresh_token \
--response-type code,id_token \
--format json \
--scope openid --scope offline \
--scope openid --scope offline --scope read \
--redirect-uri http://127.0.0.1:5555/callback
)

Expand Down
1 change: 1 addition & 0 deletions src/app/authentication/index.types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type AddEmailToIdentityResult = {
type LoginWithEmailResult = {
authToken: AuthToken
totpRequired: boolean
id?: UserId
}

type LoginWithPhoneTokenResult = {
Expand Down
2 changes: 1 addition & 1 deletion src/app/authentication/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ export const loginWithEmailToken = async ({

const res = await authServiceEmail.loginToken({ email })
if (res instanceof Error) throw res
return { authToken: res.authToken, totpRequired }
return { authToken: res.authToken, totpRequired, id: res.kratosUserId }
}

export const loginWithEmailCookie = async ({
Expand Down
1 change: 0 additions & 1 deletion src/graphql/admin/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ scalar AuthToken
type AuthTokenPayload {
authToken: AuthToken
errors: [Error!]!
id: ID!
totpRequired: Boolean
}

Expand Down
1 change: 0 additions & 1 deletion src/graphql/public/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ scalar AuthToken
type AuthTokenPayload {
authToken: AuthToken
errors: [Error!]!
id: ID!
totpRequired: Boolean
}

Expand Down
4 changes: 2 additions & 2 deletions src/graphql/shared/root/mutation/user-login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ const UserLoginMutation = GT.Field<
return { errors: [mapAndParseErrorForGqlResponse(res)] }
}

const { authToken, totpRequired, id } = res
const { authToken, totpRequired } = res

return { errors: [], authToken, id, totpRequired }
return { errors: [], authToken, totpRequired }
},
})

Expand Down
3 changes: 0 additions & 3 deletions src/graphql/shared/types/payload/auth-token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ const AuthTokenPayload = GT.Object({
totpRequired: {
type: GT.Boolean,
},
id: {
type: GT.NonNull(GT.ID),
},
}),
})

Expand Down
4 changes: 2 additions & 2 deletions src/servers/authentication/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,9 @@ authRouter.post("/email/login", async (req: Request, res: Response) => {
recordExceptionInCurrentSpan({ error: result })
return res.status(500).send({ error: result.message })
}
const { authToken, totpRequired } = result
const { authToken, totpRequired, id } = result
return res.status(200).send({
result: { authToken, totpRequired },
result: { authToken, totpRequired, id },
})
} catch (err) {
recordExceptionInCurrentSpan({ error: err })
Expand Down

0 comments on commit 7ccd2e0

Please sign in to comment.