OpenCloud.NET | Docs
DiscordGitHub
  • Introduction
  • Getting started
    • Installing
    • Log-in with OAuth2
    • Accessing user data
    • Requesting additional scopes
    • Saving users in a database
  • API Reference
    • Classes
      • OpenCloudClient (Class)
        • GetResourcesAsync (Method)
        • ExchangeCodeForTokensAsync (Method)
        • GetOAuthTokensAsync (Method)
        • IntrospectAccessToken (Method)
        • RevokeRefreshTokenAsync (Method)
      • ConfigureOpenCloudOptions (Class)
      • AccessTokenIntrospection (Class)
      • OAuthTokensSet (Class)
      • ResourceInfo (Class)
        • ResourceOwner (Class)
        • Resource (Class)
          • ResourceCreator (Class)
          • ResourceUniverse (Class)
      • User (Class)
      • ConfigureRobloxAuthenticationOptions (Class)
      • OpenCloudRobloxAuthenticationDefaults (Class)
    • Enums
      • RobloxOAuthScope (Enum)
      • ResourceOwnerType (Enum)
  • Extensions
    • AddRobloxOpenCloud (Extension)
    • GetUserInfoAsync (Extension)
    • AddRoblox (Extension)
    • RequestAdditionalScopes (Extension)
    • UseRobloxOpenCloudRouting (Extension)
  • JSON Converters
    • RobloxOAuthScopeJsonConverter (Class)
    • DateTimeOffsetJsonConverter (Class)
    • ResourceOwnerTypeJsonConverter (Class)
Powered by GitBook
On this page

Was this helpful?

  1. Getting started

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.

PreviousAccessing user dataNextSaving users in a database

Last updated 6 months ago

Was this helpful?