prescottprue/cypress-firebase

Firebase Auth Emulator JWT token signature missing

Polyrion opened this issue · 0 comments

Describe the bug

The issue occurs when I'm making an authentification with firebase auth on a phone number + uid then a code verification
http://localhost:9099/emulator/v1/projects/project-id/verificationCodes
everything working well but when I want to validate the sign in account with spree backend the jwt token is not complete the signature part is missing and I got a 403 on my request.

command.js

const fbConfig = {
  apiKey: 'YOUR_API_KEY',
  authDomain: 'YOUR_AUTH_DOMAIN',
  databaseURL: 'YOUR_URL',
  projectId: 'YOUR_PROJECT_ID',
  storageBucket: 'YOUR_BUCKET',
  messagingSenderId: 'YOUR_SENDER_ID',
  appId: 'YOUR_APPID',
  measurementId: 'YOUR_MEASUREMENT_ID',
  serviceAccountId: 'YOUR_SERVICE_ACCOUNT_ID',
}

const authEmulatorHost = Cypress.env('FIREBASE_AUTH_EMULATOR_HOST')

if (firebase.apps?.length === 0 && authEmulatorHost) {
  firebase.initializeApp(fbConfig)
  firebase.auth().useEmulator(`http://${authEmulatorHost}/`)
  console.debug(`Using Auth emulator: http://${authEmulatorHost}/`)
}

attachCustomCommands({ Cypress, cy, firebase })

signant.spec


/// <reference types="cypress" />

describe('Can access Home and Sign in to see his profile', () => {
  before(() => {
    cy.login('TEST_UID', {
      phone_number: '+33111111111',
    })
  })
  it('can visit home and go to profile page', () => {
    cy.visit('/')
    cy.get('div[data-testid="profile"]').parent().click()
  })
})

Whatever I try cy.login() or manually test the login with action I still got an incomplete JWT token