Ryan Buening
Ryan Buening

Reputation: 1660

Authenticating a Vue 2 Azure Static Web App Locally Against Auth0

I am researching the feasibility of porting an existing Vue 2 app to be an Azure Static Web App (SWA). A requirement is the ability to run the Vue app locally and authenticate against our Auth0 tenant to retrieve a access/bearer token to send along with our HTTP requests.

It appears that a SWA can utilize custom authentication (Auth0), and I was able to complete that successfully by following this article. However, I'm not seeing any information around capturing the access token. There is an /.auth/me/ endpoint which has user information, but that does not contain the access token:

enter image description here

I also looked into the Azure Static Web App Emulator which allows for defining an identity profile when running locally, but I'm not seeing a way to specify an access token here either.

Is it possible at the moment with a SWA to obtain an access token using a custom auth provider when running locally and when published live?

Upvotes: 0

Views: 262

Answers (1)

Derek Gusoff
Derek Gusoff

Reputation: 861

Managed Authentication in Azure is really only useful for fairly simple use cases. I think you're going to want to implement your security directly inside your Vue application.

https://auth0.com/docs/quickstart/spa/vuejs/01-login

You mentioned needing an access token but didn't say where it comes from or what you're doing with it. Are you trying to call an Auth0-secured API?

https://auth0.com/docs/quickstart/spa/vuejs/02-calling-an-api

Upvotes: 1

Related Questions