# /app/user/redirection

This API is for letting user to participate in Fyre event right from their user interface.

**URL**

* Prod: <https://api.fyre.hypersign.id/ext/api/v1/app/user/redirection>
* Stage: [https://stage.hypermine.in/whitelist/ext/api/v1/app/user/redirection](https://stage.hypermine.in/whitelist/ext/api/v1/app/user/redirection\\)

#### Method

POST

**Headers**

```
"Content-Type": 'application/json',
"Origin": <base URL> // Registered Base URl 
```

#### Request Body

Every request body must contain three properties: `message`, `fyresign` and `messageHash`.

**Request Body**

```javascript
{ 
 "message":{
    "appId": "6274a30fc43e35144642a484",  
     "externalUserId": "456fhrghtuht374",   
     "eventId": "6274b4cde7556226721e620c", 
     "isEmail": false, 
     "iat": 1651816302,
     "exp": 1651902702
  },
"fyresign":"0x5c25457adff5385cd037348a8c6dc3522251f31bb253c9add3636326629bc5702c5f0a496029b4ace1efe6a089df7c376d7de3c10348d6ec4b99288c8e9b3ec01c",
 "messageHash":"0x45f4b3743aad31ac28961666ee06d4930456995699f16d6a2ae17a318390da0f"
}
```

* **message**
  * **appId**: Id that you will get after creating app in Fyre platform.
  * **externalUserId**: Identifier for the user on application's platform which will be mapped with Fyre user Id.
  * **iat**: Timestamp at which the message was signed.
  * **exp**: Timestamp upto which the signature is valid.
  * **isEmail**: This is to identify whether application's user identifier is email or not
  * **metaData**: This field is to send extra parameter like `limit`, `page` values.
* **fyresign**: Signature generated by signing `message` using app's private key. Send generated signature in this field.
* **messageHash**: hash of the message.

> **Note:** If an application's user identifier is an email, then the user need not to login again at Fyre event form otherwise they do have to login again at Fyre end and that user id (or externalUserId) will be mapped with Fyre userId.

#### Response Body

Sample reponse:

```javascript
{
  "message": "Access Granted",
  "data": {
    "userRedirectionToken ": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhcHBJZCI6IjYyNzYzODcwNDBkYzQwMTRiYWM5ODVkNyIsImV4dGVybmFsVXNlcklkIjoiNDU2ZmhyZ2hmbmduanR1aHQzNzQiLCJpc0VtYWlsIjpmYWxzZSwidG9rZW5UeXBlIjoiVXNlclJlZGlyZWN0aW9uQWNjZXNzIiwiaWF0IjoxNjUyMDc0NDE2LCJleHAiOjE2NTIxNjA4MTZ9.vB01It3ZcOVkEAeRUbKPT_x26GofiS5mn3Rj1Q30MGM"
  },
  "success": true,
  "error": false
}
```

**userRedirectionToken**

Use this token in a query parameter `userRedirectionToken` in the event form URL. This is to ensure the user is coming from right application and also to map application user to the Fyre platform user.

Sample event from URL:

`https://app.fyre.hypersign.id/form/test-event?userRedirectionToken=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhcHBJZCI6IjYyNzYzODcwNDBkYzQwMTRiYWM5ODVkNyIsImV4dGVybmFsVXNlcklkIjoiNDU2ZmhyZ2hmbmduanR1aHQzNzQiLCJpc0VtYWlsIjpmYWxzZSwidG9rZW5UeXBlIjoiVXNlclJlZGlyZWN0aW9uQWNjZXNzIiwiaWF0IjoxNjUyMDc0NDE2LCJleHAiOjE2NTIxNjA4MTZ9.vB01It3ZcOVkEAeRUbKPT_x26GofiS5mn3Rj1Q30MGM`&#x20;

Developer can read the next section to know about available error codes.


---

# 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.fyre.hypersign.id/developer/apis/app-user-redirection.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.
