-
Notifications
You must be signed in to change notification settings - Fork 136
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
Authenticate as a Laravel API user using the Auth0 token #129
Comments
I've opened an issue when this should be a thread on the community site. My apologizes. |
I'm just following up on this because I'm still a bit lost - I actually have made a community post about this here with more details: https://community.auth0.com/t/native-app-laravel-api-both-with-auth0/32299 So how exactly do I use the token + user credentials from a Vue frontend (in my case its actually Nativescript-Vue), to call a Laravel API - where the Laravel API is able to authenicate and identify the user before sending them back a JSON response. @joshcanhelp @egdavid any help would greatly appreciated 😃 |
I'll answer on your Community thread but it sounds like you're on the right track! |
@krthush I hope I understood your issue. |
@egdavid So I sort of managed to do this, but my problem is that when I call the api to any of my standard Laravel routes they just redirect to the login in page... |
Managed to find a solution: https://community.auth0.com/t/native-app-laravel-api-both-with-auth0/32299/5?u=thush Thanks @egdavid @joshcanhelp ! |
Edited: I read Vue as building a single-page app but you're talking about a native app. Writing a response now on Community. |
I'm a little bit confused on what would be the best approach to achieve a simple "2 way" user Authentication using the given token.
The context
I've a Vue.js SPA that uses Auth0 to authenticate users. It works as intended, users can login and logout, token is stored in my Vuex store, expires correctly.
Beside that, I've a custom local Laravel API (JWT/Dingo API) that uses the laravel-auth0 package to check for the JWT token using the Auth0 API.
It works great, I can protect my API endpoints using the
jwt
middleware.My question
Now that my users can login to the SPA with Auth0 (using Facebook or Google), and access my custom Laravel API endpoints using the JWT tokenId, how can I register them in my Laravel APP?
This custom API needs the use of the
Auth
facade.I've tried to implement this part of the quick start, but unfortunately, I'm still confused on how I should use the
CustomUserRepository
class.How am I supposed to login/logout to/from my Laravel API in the background using the token ? Do I have to call the
getUserByDecodedJWT
from a custom endpoint with the OpenID Object as a parameter when Auth0 return a successful authentication?And then, how can I retrieve he logged-in user in my API logic?
Thanks!
The text was updated successfully, but these errors were encountered: