Auth0 - Django and Graphene
Asked Answered
D

0

8

Im currently using Graphql with Django Graphene JWT. Im using django for the backend. All requests are authed by the token shown below:

I have a schema that creates auth tokens for graphql that currently looks like this:

class Mutation(accounts_manager.schema.Mutation, device_manager.schema.Mutation, graphene.ObjectType):
    token_auth = graphql_jwt.ObtainJSONWebToken.Field()
    verify_token = graphql_jwt.Verify.Field()
    refresh_token = graphql_jwt.Refresh.Field()

Im trying to find documentation and also understand how this will work.

I have a reactjs webapp that currently connects to the graphql api and now I am also building a react native app to connect to it too.

They way I see it is that Auth0 only keeps a token per user that then is used through graphql to be authed to django?

Im a little lost about how it should all work!

Deloris answered 21/8, 2018 at 11:12 Comment(2)
Auth0 retrieves a JWT from users on the front-end when they login. From what I understand django-graphql-jwt is used if you're creating your own JWTs, therefore since Auth0 provides you with one, you don't need to use it. I think all you need to do is pass the Auth0 token with each API request and verify it on the back-end (although I'm not sure how to do this, I'm working on it ATM).Kissinger
@Deloris any luck on this? Did you find out how to make it work? My guess would be to create a custom function for Auth0 at the token_auth field, that a JWT in the same format as ObtainJSONWebToken same with the refresh token.Tisiphone

© 2022 - 2024 — McMap. All rights reserved.