身份验证 Authentication API
API 概述
API 类别 | API | 示例端点 | 描述 | 可见性 | 必传 |
---|---|---|---|---|---|
认证 | 授权 | https://www.operator.com/oauth2.0/authorize | 为未认证用户提供登录和认证页面。如果用户直接访问Vegas Lounge而未先登录运营商,则会发生这种情况。 | 公开 | 否 |
认证 | 登出 | https://www.operator.com/logout | 当玩家选择登出(包括从Vegas Lounge和运营商登出)时,这是用户将被重定向到的URL。 | 公开 | 否 |
认证 | 验证授权码 | https://api.operator.com/oauth2.0/token | Vegas Lounge将使用运营商验证短期授权码。响应结果是访问令牌。 | IP限制 | 是 |
认证 | 刷新令牌 | https://api.operator.com/oauth2.0/token | Vegas Lounge通过与运营商交换已过期的令牌以获取新令牌,来延长用户的API会话。 | IP限制 | 否 |
认证 | 获取账户信息 | https://api.operator.com/account | 返回关于用户的账户信息。 | IP限制 | 是 |
授权
请求示例
https://www.operator.com/oauth2.0/authorize?response_type=code&client_id=VL001&redirect_uri=https://fl.vegaslounge.live
请求参数 | 类型 | 描述 |
---|---|---|
response_type | TEXT(40) | 应始终为 ‘code’ |
client_id | TEXT(40) | 运营商商户ID |
redirect_uri | TEXT(255) | 成功登录后重定向玩家的URL。 |
场景示例
1.
2.
https://www.operator.com/oauth2.0/authorize?response_type=code&client_id=VL001&redirect_uri=https://fl.vegaslounge.live
3.
4.
5.
https://fl.vegaslounge.live/?code=xyz123
.登出
验证授权 (必)
WARNING
请求示例
curl -X POST 'https://api.operator.com/oauth2.0/token' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Accept: application/json' \
-d 'grant_type=authorization_code' \
-d 'code=xyz123' \
-d 'client_id=VL001' \
-d 'client_secret=77f9931747b63f720f9dbc6'
请求参数 | 类型 | 必传 | 描述 |
---|---|---|---|
grant_type | TEXT(40) | 是 | 应始终为 authorization_code |
code | TEXT(255) | 是 | 授权码(客户端API中的code URL参数值) |
client_id | TEXT(40) | 是 | 运营商商户ID。 |
client_secret | TEXT(255) | 是 | 运营商商户秘钥 |
成功响应
{
"access_token": "JewdX+n7R4DZekCEx6LxUtT87kU=",
"expires_in": 3600,
"refresh_token": "7uCIR6QZHUqYMT51OYVk2sliC3LV"
}
响应参数 | 类型 | 必传 | 说明 |
---|---|---|---|
access_token | TEXT(255) | 是 | 访问令牌。Vegas Lounge将使用此令牌向运营商API请求此玩家的信息 |
expires_in | INTEGER | 否 | 定义访问令牌到期的秒数。如果提供,Vegas Lounge将调用刷新令牌API以获取另一个令牌。默认为无到期。 |
refresh_token | TEXT(255) | 否 | 用于在访问令牌过期时获取新访问令牌的令牌 |
错误响应
{
"errorCode": 1001,
"error": "Authorization code has expired"
}
参数 | 类型 | 必传 | 描述 |
---|---|---|---|
errorCode | INTEGER | 是 | 如果success为false,运营商需要提供错误代码 |
error | TEXT(255) | 是 | 如果success为false,运营商需要提供错误信息 |