google-glassgoogle-mirror-api

GDK Authentication Process of Google Glass


In Google Glass Application using GDK

GDK Authentication Process

  1. When users turn on your Glassware in MyGlass, they are redirected to your authentication URL. These requests include a query parameter named userToken that you need to use later.

not getting the UserToken

Warning: Do not store this user token. It is only for use by Google's authentication endpoints to map the request back to the originated user during that session only and does not contain any information that can be used to persistently identify the user. The token is not guaranteed to be the same if the user authenticates with the same Glassware multiple times or if the user authenticates with different Glassware from the same developer. The user enters their credentials on your authentication page.

  1. Your server validates the user's credentials. If the credentials are valid, make a Mirror API call to the mirror.accounts.insert method. This method requires that you specify the https://www.googleapis.com/auth/glass.thirdpartyauth scope when you build your Mirror service object. Examples of making this API call using either raw HTTP or Java are shown in the account creation examples.

Using thridparty Server Authentication At the time of Creating the Account from Mirror API

From where should i get the Parameter ? like 1. User token 2. AuthType 3. AuthToken 4. AccountName

what parameter should I send?

 /**
  * 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();
     }

please help me ...


Solution

  • Here are the parameters origin: