Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

238
Views
Firebase creating custom token using spotify signin?

I am trying to implement a 'Log in with Spotify' feature for my react app. I am trying to follow this blog but I am not able use

firebase.auth().createCustomToken(uid)

as i get the error

.createCustomToken is not a function

I also tried using firebase-admin package but I run into

Can't resolve util in /node_modules/@google_cloud/common/build/src

This is what I have tried to do so far. I have never used firebase before. Any help would be appreciated.

 import {getAuth} from 'firebase-admin/auth';
 import { initializeApp } from 'firebase-admin/app';
 import admin from 'firebase-admin';

var serviceAccount = require('./service-account.json')
const spotifyApi = new SpotifyWebApi();
admin.initializeApp({
  credential: admin.credential.cert(serviceAccount)
})
let uid= 5;

getAuth().createCustomToken(uid).then(function(customToken) {
  console.log(customToken);
});
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The blog post you're following is a few years old, and recent versions of the Firebase SDK for JavaScript have switched to a different syntax (to allow build tools to automatically exclude unused parts of the SDK from you app bundle).

What used to be:

firebase.auth().createCustomToken(uid)...

Is now accomplished with:

createCustomToken(getAuth(), uid)...

For more on this, I recommend also checking out the upgrade guide for the new v9 SDK.


Update: as Dharmaraj commented below createCustomToken is still a method on the auth object.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!