Welcome to the new Box Support website. Check out all the details here on what’s changed.

Box JWTOauth App User - 404 error

New post

Comments

3 comments

  • kendomen

    Can you share your code?

    0
    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***

    Console.WriteLine(serviceAccountUserInfo.Login);

    var adminToken = session.AdminToken();

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

    Console.WriteLine();

    var adminClient = session.AdminClient(adminToken);

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

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

    //adminClient.UsersManager.GetEnterpriseUsersAsync

     

     

    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);

     

    0
    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.

    0
    Comment actions Permalink

Please sign in to leave a comment.