akselon's avatar

How to build Laravel API with routes protected by tokens obtained from Auth0.com?

Hello dear Laravel community! I'm creating a hybrid mobile app in Ionic with API build in Laravel. I'll be using OpenID Connect (Implicit flow). I'll also be using Auth0.com as Identity Server (OP). I've already created an App in Ionic, wich opens a system browser and when user is loaded it returns ID Token and an Access token from Auth0. Now I want to create some API routes in Laravel for sending user statistics from app to my database. For sure those routes should be protected by the tokens I've got from Auth0. But how to do this? Should I send ID Token to Laravel and Access token as Authentication header to the API? If yes, how can I then verify in Laravel if the Auth0 token is valid? Do I need some secret key from Auth0? On the internet I've only found some tutorials how to build whole Identity Servers in Laravel (f. eg. by using Laravel Passport), but what I need is to verify Auth0.com tokens being send from a mobile app.

0 likes
0 replies

Please or to participate in this conversation.