Skip to content

Add "Mi Token" feature so users can retrieve their Firebase UID#2

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/find-my-token
Draft

Add "Mi Token" feature so users can retrieve their Firebase UID#2
Copilot wants to merge 2 commits intomainfrom
copilot/find-my-token

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 12, 2026

Users had no way to find their Firebase UID after logging in — loginGoogle() only persisted the display name.

Changes

  • loginGoogle() — now also writes r.user.uid to localStorage["uid"] on Google sign-in (both index.html and room.html)
  • mostrarToken() — new function that reads the stored UID and copies it to clipboard via the Clipboard API, with an alert() fallback; shows a prompt to log in first if no UID is stored
  • "🔑 MI TOKEN" button — added to the header bar in both pages, wired to mostrarToken()
function loginGoogle(){
    const p = new firebase.auth.GoogleAuthProvider();
    firebase.auth().signInWithPopup(p).then(r => {
        localStorage.setItem("username", r.user.displayName);
        localStorage.setItem("uid", r.user.uid);  // ← new
        location.reload();
    });
}

function mostrarToken(){
    const uid = localStorage.getItem("uid");
    if(uid){
        if(navigator.clipboard){
            navigator.clipboard.writeText(uid).then(() => alert("🔑 Token copiado al portapapeles:\n" + uid));
        } else {
            alert("🔑 Tu Token (UID):\n" + uid);
        }
    } else {
        alert("⚠️ Inicia sesión primero con 🔐 LOGIN para obtener tu token.");
    }
}

Agent-Logs-Url: https://github.com/melvinnavas79-del/audio-room/sessions/1970f049-0b8f-4ae8-b866-bb137130a04d

Co-authored-by: melvinnavas79-del <269923432+melvinnavas79-del@users.noreply.github.com>
Copilot AI changed the title [WIP] Add instructions for finding your token Add "Mi Token" feature so users can retrieve their Firebase UID Apr 12, 2026
Copilot AI requested a review from melvinnavas79-del April 12, 2026 04:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants