> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.tangerine365.com/llms.txt.
> For full documentation content, see https://docs.tangerine365.com/llms-full.txt.

# Generate SSO Link

POST https://localhost:8090//api/user/generate-sso
Content-Type: application/x-www-form-urlencoded

Generates a secure Single Sign-On (SSO) URL for a user to log in automatically into the LMS platform, optionally for a specific course and tenant.

**Details**

- **Method**: `POST`
    
- **URL**: {{baseUrl}}/api/user/generate-sso

Reference: https://docs.tangerine365.com/tangerine-365-enterprise/generate-sso-link

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: Tangerine365 Enterprise
  version: 1.0.0
paths:
  //api/user/generate-sso:
    post:
      operationId: generate-sso-link
      summary: Generate SSO Link
      description: >-
        Generates a secure Single Sign-On (SSO) URL for a user to log in
        automatically into the LMS platform, optionally for a specific course
        and tenant.


        **Details**


        - **Method**: `POST`
            
        - **URL**: {{baseUrl}}/api/user/generate-sso
      tags:
        - ''
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Generate SSO Link_Response_200'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                auth:
                  type: string
                username:
                  type: string
                id_course:
                  type: string
                  description: optional(used to auto logged user into a course directly)
              required:
                - auth
                - username
                - id_course
servers:
  - url: https://localhost:8090
components:
  schemas:
    Generate SSO Link_Response_200:
      type: object
      properties:
        message:
          type: string
        sso_url:
          type: string
          format: uri
        success:
          type: boolean
      required:
        - message
        - sso_url
        - success
      title: Generate SSO Link_Response_200

```

## SDK Code Examples

```python Generate SSO Link_example
import requests

url = "https://localhost:8090//api/user/generate-sso"

payload = ""
headers = {"Content-Type": "application/x-www-form-urlencoded"}

response = requests.post(url, data=payload, headers=headers)

print(response.json())
```

```javascript Generate SSO Link_example
const url = 'https://localhost:8090//api/user/generate-sso';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/x-www-form-urlencoded'},
  body: new URLSearchParams('')
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Generate SSO Link_example
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://localhost:8090//api/user/generate-sso"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("Content-Type", "application/x-www-form-urlencoded")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Generate SSO Link_example
require 'uri'
require 'net/http'

url = URI("https://localhost:8090//api/user/generate-sso")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/x-www-form-urlencoded'

response = http.request(request)
puts response.read_body
```

```java Generate SSO Link_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://localhost:8090//api/user/generate-sso")
  .header("Content-Type", "application/x-www-form-urlencoded")
  .asString();
```

```php Generate SSO Link_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://localhost:8090//api/user/generate-sso', [
  'form_params' => null,
  'headers' => [
    'Content-Type' => 'application/x-www-form-urlencoded',
  ],
]);

echo $response->getBody();
```

```csharp Generate SSO Link_example
using RestSharp;

var client = new RestClient("https://localhost:8090//api/user/generate-sso");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
IRestResponse response = client.Execute(request);
```

```swift Generate SSO Link_example
import Foundation

let headers = ["Content-Type": "application/x-www-form-urlencoded"]

let request = NSMutableURLRequest(url: NSURL(string: "https://localhost:8090//api/user/generate-sso")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```