medusa
medusa copied to clipboard
Error: Unknown authentication strategy "firebase.admin.medusa-auth-plugin_firebase"
Bug report
Describe the bug
I am trying to implement firebase auth in Medusa, for which I've setup a Firebase project and it works when using the Firebase SDK from another application. To implement firebase auth in a Medusa project, I've followed the following guide to the word:
https://medusa-plugins.vercel.app/authentication/firebase
(I've also installed the plugin yarn add medusa-plugin-auth
)
System information
Medusa version (including plugins): Medusa v1.20.2, medusa-plugin-auth v1.10.3 Node.js version: v20.10.0 Database: PostgreSQL Operating system: MacOS Browser (if relevant):
Steps to reproduce the behavior
- Follow the guide: https://medusa-plugins.vercel.app/authentication/firebase
- Send a GET request to /admin/auth/firebase from Postman
Expected behavior
The request should return a 200 response with a session cookie set
Screenshots
Code snippets
medusa-config.js
{
resolve: "medusa-plugin-auth",
/** @type {import('medusa-plugin-auth').AuthOptions} */
options: [
{
type: "firebase",
// strict: "all", // or "none" or "store" or "admin"
strict: "none",
identifier: "firebase",
credentialJsonPath: CredentialJsonPath,
admin: {
authPath: '/admin/auth/firebase',
// expiresIn: 24 * 60 * 60 * 1000,
verifyCallback: (container, decodedToken, strict) => {
}
},
store: {
// authPath: '/store/auth/firebase',
// expiresIn: 24 * 60 * 60 * 1000,
// verifyCallback: (container, decodedToken, strict) => {
// // implement your custom verify callback here if you need it
// }
}
}
]
},
Additional context
Add any other context about the problem here
This is a config issue i believe, please check if you have set correctly Firebase Service Account Key file
@xyzones Thank you for the prompt response, it was indeed a config issue. I've run into another issue, however, and would appreciate some more help. While following the code snippet in the plugin guide:
const firebaseLogin = async (token: string) => {
await fetch(`${medusa_url}/${authPath}`, {
method: 'GET',
headers: {
Authorization: `Bearer ${token}`
},
credentials: 'include'
})
}
I'm getting a 401 unauthorized response. What is token here? I've tried the medusa JWT token retrieved from /auth/admin/token
to no avail.
@ishaqkhattana check the admin api docs please
@ishaqkhattana did you find a solution to this (401 unauthorized response)
Facing the same problem here, Did someone get a fix?