# SsoApi

## POST /api/v1/SsoApi/SignIn

> Automatically log users into Nexport with out requiring their login credentials. Can also create> \
> a redirect entity to attach to the subscription of the user in the organization which will cause them to> \
> be redirected upon logging out, using an expired token, or using an invalid token (if those urls are set).> \
> Can use either user\_id and org\_id OR just subscription\_id.> \
> Requires the Use SSO API permission in the subscription organization or an ancestor.

```json
{"openapi":"3.1.1","info":{"title":"NexPort Web API","version":"v1"},"servers":[{"url":"https://www.nexportcampus.com"}],"paths":{"/api/v1/SsoApi/SignIn":{"post":{"tags":["SsoApi"],"summary":"Automatically log users into Nexport with out requiring their login credentials. Can also create\r\na redirect entity to attach to the subscription of the user in the organization which will cause them to\r\nbe redirected upon logging out, using an expired token, or using an invalid token (if those urls are set).\r\nCan use either user_id and org_id OR just subscription_id.\r\nRequires the Use SSO API permission in the subscription organization or an ancestor.","operationId":"SsoApi_SignIn","parameters":[{"schema":{"type":"string"},"name":"access_token","in":"query","description":"Use the AdminApi Authenticate method to get the access_token","required":true}],"responses":{"200":{"description":"Sign on url and authentication token information","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SsoResponse"}},"text/json":{"schema":{"$ref":"#/components/schemas/SsoResponse"}}}},"403":{"description":"Not authorized to use SSO Api","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponseBase"}},"text/json":{"schema":{"$ref":"#/components/schemas/ApiResponseBase"}}}},"409":{"description":"Entity not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponseBase"}},"text/json":{"schema":{"$ref":"#/components/schemas/ApiResponseBase"}}}},"422":{"description":"Validation exception. See response body for more info.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponseBase"}},"text/json":{"schema":{"$ref":"#/components/schemas/ApiResponseBase"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SsoRequest"}},"text/json":{"schema":{"$ref":"#/components/schemas/SsoRequest"}}},"description":"Request information","required":true}}}},"components":{"schemas":{"SsoResponse":{"title":"SsoResponse","description":"Contains response information for an SSO request","default":{"url":"http://www.nexportcampus.com/suborg/controller/action?foo=bar","access_token":"12345678-1234-5678-9abc-123456789abc","token_type":"bearer","expires_in":3600,"api_error_entity":{"error_code":0,"warning_messages":[]}},"required":["url","access_token","token_type","api_error_entity"],"type":"object","properties":{"url":{"description":"Url to redirect to after SSO authentication","type":"string"},"access_token":{"format":"uuid","description":"REQUIRED.  The access token issued by the authorization server.","type":"string"},"token_type":{"description":"  REQUIRED.  The type of the token issued as described in\r\nSection 7.1.  Value is case insensitive.","type":"string"},"expires_in":{"format":"int32","description":" RECOMMENDED.  The lifetime in seconds of the access token.  For\r\nexample, the value \"3600\" denotes that the access token will\r\nexpire in one hour from the time the response was generated.\r\nIf omitted, the authorization server SHOULD provide the\r\nexpiration time via other means or document the default value.\r\nThis field will be excluded from the response if the client provides\r\na specific expiration date in the request.","type":"integer"},"api_error_entity":{"$ref":"#/components/schemas/ApiErrorEntity","description":"Error information"}}},"ApiErrorEntity":{"description":"Model used to determine what, if anything, went wrong with an api request","required":["error_code"],"type":"object","properties":{"error_code":{"format":"int32","description":"Used to denote the kind of error that occurred, if any.\r\nNoError=0;\r\nUnknownError=1;\r\nValidationError=2;\r\nItemNotFound=3;\r\nAuthenticationError=4;\r\nAuthorizationError=5;0 = No Error, 1 = Unknown Error, 2 = Validation Error, 3 = Item Not Found, 4 = Authentication Error, 5 = Authorization Error, 6 = Subscription Not Found, 7 = Enrollment Already Exists, 8 = Subscription Already Exists","enum":[0,1,2,3,4,5,6,7,8],"type":"integer"},"error_message":{"description":"Message describing what caused the error to occur","type":"string"},"warning_messages":{"description":"Warning messages describing any  potential problems with the request that do not cause the request to fail","type":"array","items":{"type":"string"},"readOnly":true}}},"ApiResponseBase":{"title":"NexPort API Response","description":"Base class for api responses","default":{"api_error_entity":{"error_code":3,"error_message":"No entity found matching id in request","warning_messages":[]}},"required":["api_error_entity"],"type":"object","properties":{"api_error_entity":{"$ref":"#/components/schemas/ApiErrorEntity","description":"Error information"}}},"SsoRequest":{"description":"A request for an SSO token. Use user_id and org_id OR just use subscription_id for specifying the subscription.","type":"object","properties":{"display":{"format":"int32","description":"Dictates whether to use the normal student display or an alternate \"no chrome\" display which\r\nremoves the NexPort header and menu items from the top of the page.\r\nNormal=0;\r\nNoChrome=1;0 = Normal, 1 = NoChrome","enum":[0,1],"type":"integer"},"user_id":{"format":"uuid","description":"Id of the user being signed in","type":"string"},"org_id":{"format":"uuid","description":"Id of the organization the user has a subscription in","type":"string"},"subscription_id":{"format":"uuid","description":"Id of the subscription. Use this if user_id and org_id are not supplied.","type":"string"},"redirect_entity_request":{"$ref":"#/components/schemas/RedirectEntityRequest","description":"Contains fields for redirecting an Sso user based on certain conditions"}}},"RedirectEntityRequest":{"description":"Contains fields for redirecting an Sso user based on certain conditions","type":"object","properties":{"logout_url":{"description":"Url to redirect user to upon logging out","type":"string"},"invalid_token_url":{"description":"Url to redirect user to if they have an invalid authentication token","type":"string"},"expired_token_url":{"description":"Url to redirect user to if they have an expired authentication token","type":"string"}}}}}}
```

## POST /api/v1/SsoApi/Classroom

> Retrieves url of classroom student view for a particular enrollment. Can also create> \
> a redirect entity to attach to the subscription of the enrollment which will cause the subscribed user to> \
> be redirected upon logging out, using an expired token, or using an invalid token (if those urls are set).> \
> Requires the Use SSO API permission in the enrollment subscription organization or an ancestor.

```json
{"openapi":"3.1.1","info":{"title":"NexPort Web API","version":"v1"},"servers":[{"url":"https://www.nexportcampus.com"}],"paths":{"/api/v1/SsoApi/Classroom":{"post":{"tags":["SsoApi"],"summary":"Retrieves url of classroom student view for a particular enrollment. Can also create\r\na redirect entity to attach to the subscription of the enrollment which will cause the subscribed user to\r\nbe redirected upon logging out, using an expired token, or using an invalid token (if those urls are set).\r\nRequires the Use SSO API permission in the enrollment subscription organization or an ancestor.","operationId":"SsoApi_Classroom","parameters":[{"schema":{"type":"string"},"name":"access_token","in":"query","description":"Use the AdminApi Authenticate method to get the access_token","required":true}],"responses":{"200":{"description":"Classroom url and authentication token information","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SsoResponse"}},"text/json":{"schema":{"$ref":"#/components/schemas/SsoResponse"}}}},"409":{"description":"Entity not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponseBase"}},"text/json":{"schema":{"$ref":"#/components/schemas/ApiResponseBase"}}}},"422":{"description":"Validation exception. See response body for more info.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponseBase"}},"text/json":{"schema":{"$ref":"#/components/schemas/ApiResponseBase"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClassroomSsoRequest"}},"text/json":{"schema":{"$ref":"#/components/schemas/ClassroomSsoRequest"}}},"description":"Contains option for chrome/nochrome and enrollment id","required":true}}}},"components":{"schemas":{"SsoResponse":{"title":"SsoResponse","description":"Contains response information for an SSO request","default":{"url":"http://www.nexportcampus.com/suborg/controller/action?foo=bar","access_token":"12345678-1234-5678-9abc-123456789abc","token_type":"bearer","expires_in":3600,"api_error_entity":{"error_code":0,"warning_messages":[]}},"required":["url","access_token","token_type","api_error_entity"],"type":"object","properties":{"url":{"description":"Url to redirect to after SSO authentication","type":"string"},"access_token":{"format":"uuid","description":"REQUIRED.  The access token issued by the authorization server.","type":"string"},"token_type":{"description":"  REQUIRED.  The type of the token issued as described in\r\nSection 7.1.  Value is case insensitive.","type":"string"},"expires_in":{"format":"int32","description":" RECOMMENDED.  The lifetime in seconds of the access token.  For\r\nexample, the value \"3600\" denotes that the access token will\r\nexpire in one hour from the time the response was generated.\r\nIf omitted, the authorization server SHOULD provide the\r\nexpiration time via other means or document the default value.\r\nThis field will be excluded from the response if the client provides\r\na specific expiration date in the request.","type":"integer"},"api_error_entity":{"$ref":"#/components/schemas/ApiErrorEntity","description":"Error information"}}},"ApiErrorEntity":{"description":"Model used to determine what, if anything, went wrong with an api request","required":["error_code"],"type":"object","properties":{"error_code":{"format":"int32","description":"Used to denote the kind of error that occurred, if any.\r\nNoError=0;\r\nUnknownError=1;\r\nValidationError=2;\r\nItemNotFound=3;\r\nAuthenticationError=4;\r\nAuthorizationError=5;0 = No Error, 1 = Unknown Error, 2 = Validation Error, 3 = Item Not Found, 4 = Authentication Error, 5 = Authorization Error, 6 = Subscription Not Found, 7 = Enrollment Already Exists, 8 = Subscription Already Exists","enum":[0,1,2,3,4,5,6,7,8],"type":"integer"},"error_message":{"description":"Message describing what caused the error to occur","type":"string"},"warning_messages":{"description":"Warning messages describing any  potential problems with the request that do not cause the request to fail","type":"array","items":{"type":"string"},"readOnly":true}}},"ApiResponseBase":{"title":"NexPort API Response","description":"Base class for api responses","default":{"api_error_entity":{"error_code":3,"error_message":"No entity found matching id in request","warning_messages":[]}},"required":["api_error_entity"],"type":"object","properties":{"api_error_entity":{"$ref":"#/components/schemas/ApiErrorEntity","description":"Error information"}}},"ClassroomSsoRequest":{"description":"Class for retrieving the url of the classroom student view","required":["enrollment_id"],"type":"object","properties":{"display":{"format":"int32","description":"Dictates whether to use the normal student display or an alternate \"no chrome\" display which\r\nremoves the NexPort header and menu items from the top of the page.\r\nNormal=0;\r\nNoChrome=1;0 = Normal, 1 = NoChrome","enum":[0,1],"type":"integer"},"enrollment_id":{"format":"uuid","description":"Id of the enrollment","type":"string"},"redirect_entity_request":{"$ref":"#/components/schemas/RedirectEntityRequest","description":"Contains fields for redirecting an Sso user based on certain conditions"}}},"RedirectEntityRequest":{"description":"Contains fields for redirecting an Sso user based on certain conditions","type":"object","properties":{"logout_url":{"description":"Url to redirect user to upon logging out","type":"string"},"invalid_token_url":{"description":"Url to redirect user to if they have an invalid authentication token","type":"string"},"expired_token_url":{"description":"Url to redirect user to if they have an expired authentication token","type":"string"}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.nexportsolutions.com/nexport-user-documentation/developer-documentation/campus-webapi/ssoapi.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
