Requesting additional scopes

When users navigate to the LogInPath they will be prompted to grant the scopes defined in AddRoblox(), however these scopes might be insufficient sometimes. For example your application has an optional feature which requires creating assets on behalf of the user.

To request additional scopes, create a controller action which returns an OpenCloud.Roblox challenge with additional scopes defined in AuthenticationProperties.Items.

Create an AuthController in the Controllers folder and replace the class code to the following:

AuthController.cs
public class AuthController : Controller
{
    public IActionResult MoreScopes()
    {
        AuthenticationProperties authenticationProperties = new()
        {
            RedirectUri = "/"
        };
        authenticationProperties.RequestAdditionalScopes(BloxTeams.OpenCloud.Enums.RobloxOAuthScope.AssetWrite);

        return Challenge(authenticationProperties, OpenCloudRobloxAuthenticationDefaults.AuthenticationScheme);
    }
}

The above code snippet uses the RequestAdditionalScopes() method which validats and adds the desired scopes to AuthenticationProperties.Items.

When users navigate to /auth/morescopes they will be redirected to the Roblox authorization page where they will be prompted to grant scopes defined in AddRoblox() and the additional scopes.

Last updated

Was this helpful?