Skip to content

Commit

Permalink
fixed client to return also token
Browse files Browse the repository at this point in the history
  • Loading branch information
jhnnsrs committed Sep 20, 2024
1 parent 090fb47 commit 50d0010
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions fakts/graphql/mutations/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@



def create_developmental_client(info: Info, input: inputs.DevelopmentClientInput) -> str:
def create_developmental_client(info: Info, input: inputs.DevelopmentClientInput) -> types.Client:


composition = Composition.objects.get(name=input.composition) if input.composition else Composition.objects.first()
Expand Down Expand Up @@ -48,7 +48,7 @@ def create_developmental_client(info: Info, input: inputs.DevelopmentClientInput
)


return token
return client



9 changes: 7 additions & 2 deletions fakts/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ class Oauth2Client:
name: str
user: types.User
client_type: str
client_id: str
algorithm: str
authorization_grant_type: str
redirect_uris: str
Expand All @@ -109,13 +110,17 @@ class Client:
public: bool = strawberry.field(description="Is this client public? If a client is public ")
composition: Composition = strawberry.field(description="The composition of the client. ")
user: types.User | None = strawberry.field(description="If the client is a DEVELOPMENT client, which requires no further authentication, this is the user that is authenticated with the client.")
token: str = strawberry.field(description="A token that can be used to retrieve the configuration of the client. When providing this token during the configuration flow, the client will received its configuration (the filled in `composition`)")


@strawberry.field(description="The configuration of the client. This is the configuration that will be sent to the client. It should never contain sensitive information.")
def kind(self, info) -> enums.ClientKind:
if self.kind == "website": return enums.ClientKind.WEBSITE
if self.kind == "desktop": return enums.ClientKind.DESKTOP
if self.kind == "development": return enums.ClientKind.DEVELOPMENT

@strawberry.field(description="The configuration of the client. This is the configuration that will be sent to the client. It should never contain sensitive information.")
def token(self, info) -> str:
# TODO: Implement only tenant should be able to see the token
return self.token



Expand Down

0 comments on commit 50d0010

Please sign in to comment.