Oauth / MFA Management¶
Unless otherwise stated, endpoints are relative to https://api.groupme.com/v3/ and must include the token of the user making the call - so, for example, if an endpoint is GET /groups
, the request you make should be using the URL https://api.groupme.com/v3/groups?token=aSDFghJkl
, where aSDFghJkl
is replaced with the user's token.
URLs which include a variable, such as GET /groups/:id
, have their variables marked with a colon. So a request to that endpoint would look like https://api.groupme.com/v3/groups/1234567?token=aSDFghJkl
, where 1234567
is replaced with the group's ID, and aSDFghJkl
is replaced with the user's token.
Finally, all responses are wrapped in a response envelope of the following form:
If the request succeeds, meta.errors
will be null, and if the request fails, response
will be null.
Logging In¶
This is how you authenticate a GroupMe account's email and password in order to receive an API token.
Sometimes, when an account has MFA enabled or you're logging in from a new device, this call requires a user to answer an MFA challenge using a pin sent to their phone and then retry logging in using the code attached to the MFA interaction.
Important
This request is relative to https://v2.groupme.com/
, not https://api.groupme.com/v3/
.
Parameters
-
app_id (required)
string - the name of the application you're attempting to authorize, this can be anything.
-
grant_type (required)
string - as far as we're aware, the only acceptable value for this parameter is
"password"
. -
password (required)
string - your GroupMe account's password
-
username (required)
string - the username or email registered with your account
-
device_id
string - this is an optional device identifier which is stored by GroupMe. It can be anything you want, but it should be specific to the device/client. If you haven't logged in with this device ID before (or if you leave it empty), the server will Force an MFA challenge by verifying your phone number. Even if MFA is not enabled for your account.
-
verification
object - this optional object contains the parameter
code
, which should be set to a valid MFA interaction ID if you have one. Normally you send this API call once without this parameter, then if you receive an an MFA challenge, you'd solve the challenge and try this call again, including theverification
parameter.
Or, if an MFA challenge is thrown:
See how to authorize this MFA verification code in the next section.
Handling MFA Challenges¶
The MFA system is relatively straightforward. When the server requires multi-factor authentication, it will issue the client an MFA code ID.
Your client follows one of a few methods to verify that MFA ID, and then passes it back to the server.
Option 1: They text you
To tell the server to send a text:
Parameters
-
mfa_id
string - this is the long string given to you whenever the server requires an MFA challenge. It should look something like:
5bdbac1c43224a21d02dc94747ae732e31161ba4-700d069528b2364ebc32b9f721b25d93239279d3
.
Now you can verify the pin:
Parameters
-
mfa_id
string - this is the long string given to you whenever the server requires an MFA challenge.
-
pin
string - the pin texted to you when you initiated the MFA challenge. Alternatively, this can be a backup code that was generated when you initially activated MFA for your account.
If the pin is correct, you will receive a response that looks like this:
If the pin was incorrect, you will receive a response indicating how many tries you have left.
At this point, the MFA code you've been given should be verified and you can pass it along to whatever call initiated the MFA interaction.
Option 2: You text them
This doesn't require an initiation step, instead, you send a text containing the long_pin
to the system_number
provided when the server issues an MFA challenge.
Official clients use a text that looks like this:
Text | |
---|---|
Where c9b6acf22f61
is the long_pin
you received from the server.
Because sending a text is asynchronous, you need to wait and validate that the server has received your SMS before attempting to use the MFA ID. You can do this via polling the ID to see if it's validated yet.
Tip
You can use this call to check if any MFA ID is valid, not just ones where you're sending the text. It's most relevant here, so thats why we include it.
HTTP Request | |
---|---|
Parameters
-
mfa_id
string - this is the long string given to you whenever the server requires an MFA challenge. It should look something like:
5bdbac1c43224a21d02dc94747ae732e31161ba4-700d069528b2364ebc32b9f721b25d93239279d3
.
At this point, the MFA code you've been given should be verified and you can pass it along to whatever call initiated the MFA interaction.
Creating an MFA backup code¶
This allows you to pass an MFA challenge without access to your phone. It's submitted exactly the same way you would an SMS pin.
HTTP Request | |
---|---|
Enabling MFA¶
This call activates an MFA channel for your account, it works just like logging in.
You make this call once without an MFA verification object, receive an MFA ID for the interaction, validate it using the steps detailed in the Handling MFA Challenges section, then make this call a second time including the now verified MFA ID.
After establishing the MFA channel you must enable it with a seperate call.
Important
Activating MFA will log you out everywhere, including 3rd party Oauth apps. This proccess will invalidate your current API token and return a new one that you should use to make subsequent API calls.
HTTP Request | |
---|---|
Parameters
-
method (required)
string - Must be
"phone_number"
(the only known working method) -
code
string - A verified MFA ID obtained by completing the verification challenge. This only needs to be inlcuded on the second request you make to this endpoint.
On the first call you make, whithout sending a verification code, the response should look like this:
HTTP Response | |
---|---|
After the second call including a verified MFA ID, the response should look like this:
Now that the MFA channel is established, we can enable it like this:
Disabling MFA¶
This call turns off MFA for your account
HTTP Response | |
---|---|
Index authorized apps¶
List applications with active tokens.
Please note that this call does not list the tokens themselves, or when they will expire. It only provides enough information to tell you which clients currently have access to your account.
Important
This request is relative to https://v2.groupme.com/
, not https://api.groupme.com/v3/
.
HTTP Request | |
---|---|
HTTP Response | |
---|---|
Revoking an API token / Oauth Application¶
This call invalidates a token with a particular token ID, which can be identified using the call above.
Important
This request is relative to https://v2.groupme.com/
, not https://api.groupme.com/v3/
.
HTTP Request | |
---|---|
Parameters
-
token_id
string - the ID of the token you want to revoke. This can be found in the
GET /access_tokens
response.
HTTP Response | |
---|---|
Changing your Account Password¶
Important
This call will log you out everywhere and will revoke the token you're currently using. In order to get a new API token, you will need to log back in with your new password
HTTP Request | |
---|---|
Parameters
-
password
string - this is your new password
-
password_current
string - this is your current password