Skip to content

OAuth API

For information on OAuth client settings, please refer to the section below, "Set provider that can be used in NextAuth"

Set provider that can be used in NextAuth

jsx
{
  id: "vroid",
  name: "VRoid Hub",
  type: "oauth",
  version: "2.0",
  scope: "default",
  params: { grant_type: "authorization_code" },
  accessTokenUrl: "https://hub.vroid.com/oauth/token",
  requestTokenUrl: "https://hub.vroid.com/oauth/token",
  authorizationUrl: "https://hub.vroid.com/oauth/authorize?response_type=code",
  profileUrl: "https://hub.vroid.com/api/account",
  async profile(profile, tokens) {
    return {
      id: profile.data.user_detail.user.id,
      name: profile.data.user_detail.user.name,
      image: profile.data.user_detail.user.icon.sq170.url
    }
  },
    headers:{
            "X-Api-Version":11 //VRoid Hub proprietary parameter
          },
  clientId: "",
  clientSecret: ""
}

Request to initiate authorization

GET: /oauth/authorize


X-Api-Version

Required: YES

  • This is the VRoid Hub API version. The current version is version 11.

Request parameters


response_type

Required: Yes
Type: string

  • For this parameter, you must input code

client_id

Required: Yes
Type: string

redirect_uri

Required: Yes
Type: string

scope

Required: Yes
Type: string


Response

302

  • After user authorization on VRoid Hub via the redirect to the VRoid Hub authorization page, the user will be redirected to the URL set for redirect_uri, along with the code parameters.

400

  • Return error based on OAuth 2.0

Request access token

POST: /oauth/token

Header


X-Api-Version

Required: YES

  • This is the VRoid Hub API version. The current version is version 11.

Request parameters


client_id

Required: Yes
Type: string

client_secret

Required: Yes
Type: string

redirect_uri

Required: Yes
Type: string

grant_type

Required: Yes
Type: string

  • Please input the authorization_code. When using refresh tokens, please input refresh_token.

code

Required: Yes
Type: string

  • When "request to initiate authorization" is made, please input the code received from the redirect_uri.

refresh_token

Required: No
Type: string

  • When grant_type = refresh_token, please input refresh token.

Response

200

{
  "access_token": string,
  "token_type": string,
  "expires_in": number,
  "refresh_token": string
}
  • To use accsess_token, please add Authorization: Bearer ${access_token} to the header when making an API request.

400

  • Return error based on OAuth 2.0

## Revoke access token

POST: /oauth/revoke

Header


X-Api-Version

Required: YES

  • This is the VRoid Hub API version. The current version is version 11.

Request parameters


token

Required: YES
Type: string

  • Specify accsess_token you have already obtained. and add Authorization: Bearer ${access_token} to the header.

Response

200

  • Return error based on OAuth 2.0

400

  • Return error based on OAuth 2.0