gpt4 book ai didi

c# - 输入不是有效的 Base64 字符串,因为它包含非 Base 64 字符

转载 作者:行者123 更新时间:2023-12-02 19:21:19 28 4
gpt4 key购买 nike

我从 flutter mobile app 接收到我的 asp.net core api 的以下 token ,我需要将其发送到 firebase api 以验证我的 token 并获取 firebase uid。我在.net core中的代码是

   FirebaseToken decodedToken = await FirebaseAuth.DefaultInstance.VerifyIdTokenAsync(token);
string uid = decodedToken.Uid;

我收到的错误为

The input is not a valid Base-64 string as it contains a non-base 64character, more than two padding characters, or an illegal characteramong the padding characters.

我尝试在末尾添加 '=' 以使长度可被 4 整除。但没有用。有人可以帮忙吗?

token = "eyJhbGciOiJSUzI1NiIsImtpZCI6IjZjZmMyMzViZDYxMGZhY2FlYzVlYjBhZGU5NTg5ZGE5NTI4MmRlY2QiLCJ0eXAiOiJKV1QifQ.eyJuYW1lIjoiUHJhYmhha2FyIiwiYWRtaW4iOnRydWUsImlzcyI6Imh0dHBzOi8vc2VjdXJldG9rZW4uZ29vZ2xlLmNvbS9ydXRodW1hbmEtYXBwIiwiYXVkIjoicnV0aHVtYW5hLWFwcCIsImF1dGhfdGltZSI6MTU5NTE3MTE4MCwidXNlcl9pZCI6IjVVTUVoY1pGUklQUVRZSXYyUkt4Tk01cTdHbzIiLCJzdWIiOiI1VU1FaGNaRlJJUFFUWUl2MlJLeE5NNXE3R28yIiwiaWF0IjoxNTk1MzYxNDQyLCJleHAiOjE1OTUzNjUwNDIsImVtYWlsIjoicHJhYmhha2FyYmhhdEBsaXZlLmNvbSIsImVtYWlsX3ZlcmlmaWVkIjp0cnVlLCJwaG9uZV9udW1iZXIiOiIrOTE4NTUzNzUyNzQyIiwiZmlyZWJhc2UiOnsiaWRlbnRpdGllcyI6eyJwaG9uZSI6WyIrOTE4NTUzNzUyNzQyIl0sImVtYWlsIjpbInByYWJoYWthcmJoYXRAbGl2ZS5jb20iXX0sInNpZ25faW5fcHJvdmlkZXIiOiJwaG9uZSJ9fQ.N-fFCQHnJkdVcSqRQQ7XetEPQEeLCjOofjv3UogJlehLlUiJZhoKO6UWnb_liNxuTaFQ7tzvl03rHbm12na6KkhMup0J_UkC7HCyG6EtZmCgc8KmFRoYtHbztiCNI9v26QLPI_5C-KCnMDJdnvmGfuhh5NmmR5gC1LVuXMxZxaQFzcs1fkuA_8mCY1t4s0x0mQyeBUdrLVZnWdVSzM9-g1WZ0xrCrcsf7WTdWpuWeRmSIJSmNagP_l7R-uYUnTtwNISgFVn4mhSz4O1dqav7167TK2Z1PQD1QDhMA3FTIoYsc9izdlXQvmkbLxkq8dvhgxYVY"

最佳答案

点不是无效 token 。它是一个分隔符。该 token 由三个 base64 编码部分组成。看看回复: https://repl.it/@AlieksandrAlie7/ZestyActiveOutput#index.js

此外,您可能会注意到最后一部分包含无效字符。根据下表:

https://s3.amazonaws.com/stackabuse/media/decimal-to-base64-table.png

也许替换无效字符可能有效:

- => +
_ => /

关于c# - 输入不是有效的 Base64 字符串,因为它包含非 Base 64 字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63022661/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com