Box JWTOauth App User - 404 error

New post



  • kendomen

    Can you share your code?

    Comment actions Permalink
  • cgopalakrishna

    var session = new BoxJWTAuth(BoxConfig.CreateFromJsonFile(fs));

    var serviceAccountClient = session.AdminClient(session.AdminToken());

    // Use the GetCurrentUserInformationAsync method to retrieve current user's information.

    // Since this client uses the Service Account, this will return the Service Account's information.

    var serviceAccountUserInfo = await serviceAccountClient.UsersManager.GetCurrentUserInformationAsync();

    // Log the Service Account's login value which should contain "AutomationUser".

    // For example, ***email address removed for privacy***


    var adminToken = session.AdminToken();

    Console.WriteLine("Admin Token: " + adminToken);


    var adminClient = session.AdminClient(adminToken);

    //var userRequest = new BoxUserRequest() { Name = "test appuser", IsPlatformAccessOnly = true };

    //var appUser = await adminClient.UsersManager.CreateEnterpriseUserAsync(userRequest);




    Console.WriteLine("Created App User");

    var userToken = session.UserToken("***number removed for privacy***4");

    var userClient = session.UserClient(userToken, "***number removed for privacy***4");

    var userDetails = await userClient.UsersManager.GetCurrentUserInformationAsync();

    Console.WriteLine("\nApp User Details:");

    Console.WriteLine("\tId: {0}", userDetails.Id);

    Console.WriteLine("\tName: {0}", userDetails.Name);

    Console.WriteLine("\tStatus: {0}", userDetails.Status);

    Console.WriteLine("\tLogin: {0}",userDetails.Login);


    Comment actions Permalink
  • cgopalakrishna

    I created user and then I had to grant permission to that user to the Box folder. And use the User ID to get user and then I was able to upload the file. Not sure if this is the right way to do. I was thinking the user created through app will automatically have access same as the app.

    Comment actions Permalink

Please sign in to leave a comment.