Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access token of logged in user #11

Closed
jackfranklin opened this issue Aug 14, 2019 · 4 comments
Closed

Access token of logged in user #11

jackfranklin opened this issue Aug 14, 2019 · 4 comments

Comments

@jackfranklin
Copy link

I'm using Auth0 to allow users to login via GitHub.

I now need to get at the OAuth token from GitHub so I can make authorised requests to the GitHub API. I think maybe useAuth could expose this token too, if it can? (I'm not super familiar with auth0 so sorry if I'm heading down the wrong path here).

This library made auth so much easier so thank you for that!

@bluematter
Copy link

bluematter commented Aug 14, 2019

@jackfranklin Just in time. I also need to obtain the id_token to add into the headers of my requests to graphcool.

Would be nice to document this and expose the token.

I wonder if the cookie that was stored can be parsed into a token? I'll look into that.

@NWRichmond
Copy link
Contributor

@jackfranklin @bluematter
I haven't tried it, but you might be able to accomplish that by creating an Auth0 Rules function. The video in the link explains how to implement custom logic such that, "...you could easily change this to query one of your databases or make an API call to an external server as needed."

@puregarlic
Copy link

@bluematter @jackfranklin I've made some changes to a local version of useAuth that exposes both id_token and access_token; I'll get a PR up soon for discussion.

@Swizec
Copy link
Owner

Swizec commented Aug 20, 2019

@jackfranklin @NWRichmond @puregarlic @bluematter just published version 0.4.0, which exposes the full authResult object which contains your accessToken and idToken ✌️

https://github.com/Swizec/useAuth#users-access-tokens

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

No branches or pull requests

5 participants