使用GDK的Google Glass应用程序
GDK身份验证流程
未获取UserToken
警告:请勿存储此用户令牌。仅供Google的身份验证端点使用,仅在该会话期间将请求映射回原始用户,并且不包含可用于持久识别用户的任何信息。如果用户多次使用相同的Glassware进行身份验证,或者用户使用来自同一开发人员的不同Glassware进行身份验证,则不能保证令牌相同。 用户在您的身份验证页面上输入凭据。
使用thridparty服务器身份验证 在从镜像API创建帐户时
我应该从哪里获得参数?喜欢 1.用户令牌 2. AuthType 3. AuthToken 4. AccountName
我应该发送什么参数?
/**
* Creates an account and causes it to be synched up with the user's Glass.
* This example only supports one auth token; modify it if you need to add
* more than one, or to add features or user data or the password field.
*
* @param mirror the service returned by getMirrorService()
* @param userToken the user token sent to your auth callback URL
* @param accountName the account name for this particular user
* @param authTokenType the type of the auth token (chosen by you)
* @param authToken the auth token
*/
public static void createAccount(Mirror mirror, String userToken, String accountName,
String authTokenType, String authToken) {
try {
Account account = new Account();
List<AuthToken> authTokens = Lists.newArrayList(
new AuthToken().setType(authTokenType).setAuthToken(authToken));
account.setAuthTokens(authTokens);
mirror.accounts().insert(
userToken, ACCOUNT_TYPE, accountName, account).execute();
} catch (IOException e) {
e.printStackTrace();
}
请帮帮我......
答案 0 :(得分:0)
以下是参数来源:
userToken
:如果您不知道,请让审核小组知道,以便他们可以修复后端缺少的内容。请务必指定您要使用GDK身份验证。accountName
取决于您:这是您要插入的用户帐户的名称。authTokenType
也取决于您,但需要与您为审核小组提供的内容完全匹配。authToken
是您的服务生成的令牌:同样,这是您为用户插入的令牌。