Sign In with Party Social

Get Started

Making a verified app requires Party Social Pro.

First, create an app at https://party-social.com/apps/create. After you can created the app, create a URL by clicking "Create URL," and select your redirect URL. The URL should look like this:

https://party-social.com/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=http://example.com

Design a Button to Sign in With Party Social. After the user signs in, they will be redirected to your URL with two parameters. One is the auth code and the other is state, if set. The auth code can be used to get the user's display name, username, and profile picture.

Exchange Authorization Code for Access Token

POST /token

Send a POST request to the token endpoint

Headers

NameValue

Content-Type

Body

NameValue

code

client_id

client_secret

redirect_uri

Response

{ 
    access_token: "accessToken",
    token_type: "bearer", 
    expires_in: 3600 
}

Fetch User's Info

The auth code expires in 5 minutes.

GET /auth/user

Get the user's info

Headers

NameValue

Content-Type

Authorization

client_id

Response

{
  uid: "User's UID",
  photoURL: "User's PFP",
  name: "User's Display Name",
  username: "User's Username",
  : "CUSTOM TOKEN"
}

To make a custom client, you must use the CUSTOM TOKEN to connect with Socket.io.

Example

const params = new URLSearchParams(window.location.search)

fetch('http://api.party-social.com/auth/user', {
    headers: {
        authorization: params.get('code'),
        client_id: params.get('client_id'),
    }
}).then(req => req.json()).then(data => {
    localStorage.setItem("user", data.token)
    location = '/'
})

Example

An example can be found on GitHub: https://github.com/PartySocial/oauth-example

Last updated