Oauth 与Google Signin和React Native的跨平台身份验证差异
我正在尝试用react native编写的移动应用程序实现后端身份验证。我设法让它与android一起工作,但我在iOS上遇到了问题 对于Android,webClientId显示在生成的令牌的aud字段中,该令牌由后端进行检查。但在iOS上,它是iOSClientId。因此,iOS上的身份验证失败 谷歌登录模块的配置:Oauth 与Google Signin和React Native的跨平台身份验证差异,oauth,react-native,google-signin,Oauth,React Native,Google Signin,我正在尝试用react native编写的移动应用程序实现后端身份验证。我设法让它与android一起工作,但我在iOS上遇到了问题 对于Android,webClientId显示在生成的令牌的aud字段中,该令牌由后端进行检查。但在iOS上,它是iOSClientId。因此,iOS上的身份验证失败 谷歌登录模块的配置: GoogleSignin.configure({ scopes: [], // what API you want to access on behalf of the
GoogleSignin.configure({
scopes: [], // what API you want to access on behalf of the user, default is email and profile
iosClientId: '817980298693-[...].apps.googleusercontent.com', // only for iOS
webClientId: '181764353768-fdc[...].apps.googleusercontent.com', // client ID of type WEB for your server (needed to verify user ID and offline access)
});
{
"iss": "https://accounts.google.com",
"aud": "817980298693-[...].apps.googleusercontent.com",
"azp": "817980298693-[...].apps.googleusercontent.com",
[...]
}
{
"iss": "https://accounts.google.com",
"aud": "181764353768-fdc[...].apps.googleusercontent.com",
"azp": "181764353768-2rs[...].apps.googleusercontent.com",
[...]
}
在iOS上生成的令牌的内容(从):
GoogleSignin.configure({
scopes: [], // what API you want to access on behalf of the user, default is email and profile
iosClientId: '817980298693-[...].apps.googleusercontent.com', // only for iOS
webClientId: '181764353768-fdc[...].apps.googleusercontent.com', // client ID of type WEB for your server (needed to verify user ID and offline access)
});
{
"iss": "https://accounts.google.com",
"aud": "817980298693-[...].apps.googleusercontent.com",
"azp": "817980298693-[...].apps.googleusercontent.com",
[...]
}
{
"iss": "https://accounts.google.com",
"aud": "181764353768-fdc[...].apps.googleusercontent.com",
"azp": "181764353768-2rs[...].apps.googleusercontent.com",
[...]
}
Android上生成的令牌的内容(来源):
GoogleSignin.configure({
scopes: [], // what API you want to access on behalf of the user, default is email and profile
iosClientId: '817980298693-[...].apps.googleusercontent.com', // only for iOS
webClientId: '181764353768-fdc[...].apps.googleusercontent.com', // client ID of type WEB for your server (needed to verify user ID and offline access)
});
{
"iss": "https://accounts.google.com",
"aud": "817980298693-[...].apps.googleusercontent.com",
"azp": "817980298693-[...].apps.googleusercontent.com",
[...]
}
{
"iss": "https://accounts.google.com",
"aud": "181764353768-fdc[...].apps.googleusercontent.com",
"azp": "181764353768-2rs[...].apps.googleusercontent.com",
[...]
}
因此,我的问题是:
- webClientId在iOS上生成的令牌中不出现是正常的吗
- 我应该在后端检查两个客户端ID,还是有办法在两个平台上都有相同的行为