---
title: Examples
slug: infra/examples
createdAt: 2021-08-31T10:17:18.000Z
---

# Introduction

The content that your user sees depends on the **payload** that you initialize the Socratease library with. This article lists a few common use cases.

In the examples below, we will only show what the [Payload](docId:_7cy1QkSWkEzcP719c1Vu) must be like. Refer the [Quickstart](docId\:BHVlNoVFlH6J1_2ttFsSw) article for boilerplate code, and other options.

Recall that for all Socratease related pages, you will have a **single** entry point. If you are hosting Socratease on [yoursite.com/learning](#) (see [Definitions](docId:7DwbPBPjXUvH38h-r2hEL)), for all URLs like [yoursite.com/learning/\*](#), you will return a static HTML page



## Content Creation

### Requirement

You want a user with `username=creator@yoursite.com` to see the screen where they can add quizzes, create courses, etc

### Code

```javascript
const payload = {
    username: "creator@yoursite.com",
    user_details: {first_name: "Creator", role: "ca"}
};
```

### Explanation

1. We need the `username` because we need to keep track of who created the content. (If username isn't created, Socratease will create a random user depending on your [Non-Logged in Users in .init()](docId:7kqWrGpMaG5UCZpqqZ2Nq) and [Unauthenticated and Unauthorized requests](docId\:iBscLwetDIxD0L2ZMawLz) settings).
2. Because you are initialising the user with `role=ca`, Socratease will automatically redirect the user to [/cms/home](#). Here the user can see their existing content, or create new content.





## Accessing Existing Content

### Requirement

A content creator has created a quiz. In its settings, the creator has said that only logged-in users can access it. Its relative url is, [/units/abcd](#) You want a user with `username=student@yoursite.com` to take this quiz.

### Code

```javascript
const payload = {
    username: "student@yoursite.com",
    user_details: {first_name: "Student"}
};
```

### Explanation

Because only logged-in users can access the test, `username` is required. You don't need to specify `path` here because, by default, the SDK loads `window.location.pathname` anyway.





## Creating a Cohort

### Requirements

An instructor needs to be logged in to show a page where they can create cohorts and see their existing cohorts. The instructor has already been added to an Organization

### Code

```javascript
const payload = {
    username: "student@yoursite.com",
    user_details: {first_name: "Student", role: "instructor"}
};
```

### Explanation

Because only logged-in users can access the test, `username` is required. You don't need to specify `path` here because, by default, the SDK loads `window.location.pathname` anyway.

