我正在尝试使用firebase管理员sdk for python来制作自定义令牌并在测试我的应用时验证这些令牌。问题是,当我尝试验证令牌时,我总是遇到这样的错误:
.386
.model flat,stdcall
option casemap:none
include windows.inc
include masm32.inc
includelib masm32.lib
include kernel32.inc
includelib kernel32.lib
include user32.inc
includelib user32.lib
.code
;requires power > 0 for correct answers
pow proc x:DWORD, power:DWORD
;THESE TWO MOVES RIGHT HERE ARE NOT WORKING AS EXPECTED
;I PUSH 2 ONTO STACK BUT WHEN I LOOK AT REGISTER VALUES
;IN DEBUG THEY ARE INCORRECT/GARBAGE
mov eax, x ;eax has x
mov edx, power ;edx has power
mov ecx, eax ;ecx will be my constant base
start_power:
cmp edx, 1 ;is power 1?
je end_power ;then jump to end
imul eax, ecx ;else mul result/x with x
dec edx ;power--
jmp start_power ;jump back to beginning of loop
end_power:
ret ;return answer eax
pow endp
start:
invoke pow, 2, 2 ;eax should hold 4 after this
invoke ExitProcess, eax ;program should exit with code eax, ez way to print result
end start
我按照指南创建了应用并制作了令牌:
ValueError: Firebase ID token has incorrect "aud" (audience) claim. Expected "my_project_id" but got "https://identitytoolkit.googleapis.com/google.identity.identitytoolkit.v1.IdentityToolkit". Make sure the ID token comes from the same Firebase project as the service account used to authenticate this SDK. See https://firebase.google.com/docs/auth/admin/verify-id-tokens for details on how to retrieve an ID token.
在这里我得到了错误。似乎_TokenGenarator是使用从错误中返回的默认值初始化的。我认为在通过应用程序时它应该自动更改那些但它没有发生。我错过了什么吗?
答案 0 :(得分:3)
verify_id_token()
仅接受ID令牌。自定义令牌不属于该类别。见test case。在这种情况下,提升ValueError
是预期的行为。
可以从client SDK获取ID令牌。您可以通过调用提供的signInWithCustomToken()
方法之一来为ID令牌交换自定义令牌。