Jump to content

[Guide] GTAW oAuth WordPress Plugin


Recommended Posts

GTAW WordPress Bridge Plugin


 

The GTA:W Bridge plugin integrates GTA:W OAuth authentication with WordPress, allowing GTA:W users to create character-based WordPress accounts. Each character the user selects from the GTA:W API becomes its own WP account, and returning users can choose which character account to log in as.

 

Demo available here: https://vommoda.com/

Installation


 

Spoiler

Upload and Activate the Plugin

  • Download the plugin ZIP file.
  • In your WordPress admin dashboard, navigate to Plugins > Add New.
  • Click Upload Plugin, choose the ZIP file, and then click Install Now.
  • Once installed, click Activate.

Verify Dependencies

  • Make sure WooCommerce is installed and activated. If it isn’t, the plugin will display an admin notice.

Configuration


 

Spoiler

After activation, you’ll need to configure the plugin settings.

 

Upload and Activate the Plugin

In the WordPress admin sidebar, you should now see a top-level menu item called GTA:W Bridge. Click on it. 

The settings page displays three tabs at the top:

  • GTA:W oAuth
  • Fleeca API (Coming Soon)
  • Discord Sync (Coming Soon)

 

68747470733a2f2f692e696d6775722e636f6d2f

 

In the GTA:W oAuth tab, you’ll see the following fields:

  • OAuth Client ID: Enter your GTA:W Client ID from the GTA:W UCP Developers section.
  • OAuth Client Secret: Enter your GTA:W Client Secret from the GTA:W UCP Developers section.
  • OAuth Callback/Redirect URL: This field is auto-generated (e.g., https://yoursite.com/?gta_oauth=callback). Ensure that the callback URL configured in your GTA:W UCP Developers section matches this URL.

 

After filling in these fields, click the Save Changes button. The Fleeca API and Discord Sync tabs currently display “Coming Soon.” These tabs will be updated as new features are developed. All sensitive credentials (Client ID and Secret) are stored as plugin options and are not hard-coded in the plugin files.

Usage


 

Spoiler

Using the OAuth Login Link
You can embed the login link anywhere on your site using the shortcode: [gtaw_login] Alternatively, you can use the link directly (as generated and shown in the settings page). When a user clicks the login link, they are redirected to the GTA:W OAuth page. After authenticating on GTA:W, they are redirected back to your website. The plugin saves the GTA:W API response (user data and list of characters) in a cookie.

 

Account Creation – First Login

 

68747470733a2f2f692e696d6775722e636f6d2f

 

If the plugin determines that there is no existing WordPress account linked to the GTA:W user, a modal appears on the site prompting the user to select a character from the GTA:W API response. The modal displays a dropdown list of all characters. When the user selects a character and clicks Create Account & Login, the plugin:

  • Creates a new WP account using the selected character’s details.
    • Username: Generated as (firstname)_(lastname) (all lower-case and sanitized). If the username already exists, a timestamp is appended.
    • Email: Set as [email protected]
    • First Name/Last Name: Set to the character’s first and last names.
  • Saves the GTA:W user ID in user meta (key: gtaw_user_id).
  • Saves the selected character as both the connected character (in gtaw_characters) and as the active character (active_gtaw_character).
  • Logs the user in using WordPress authentication cookies.

 

Returning User Flow – Logging in and Switching Character

 

68747470733a2f2f692e696d6775722e636f6d2f

 

The plugin checks for existing WP accounts using the GTA:W user ID stored in user meta.A modal appears with two sections:

  • Login with an Existing Account: Displays a dropdown list of accounts (each representing a connected character). Clicking Login calls an AJAX endpoint that updates the active character and logs the user in.
  • Register a New Character: Displays a dropdown list of GTA:W characters that are not yet connected to any WP account. Clicking Register New Account creates a new WP account for that character.

If a user is already logged in and wants to switch the active character, they can do so from the returning user modal. This updates both the user meta and the WP profile (first name, last name, display name, etc.) to reflect the new character. The plugin logs the user in with the updated profile.

Troubleshooting


 

Spoiler

Cookie Issues

Ensure that your site isn’t blocking cookies, as the plugin relies on cookies (named gtaw_user_data) to store the GTA:W API response.

 

OAuth Callback
If users are not being redirected back properly after logging into GTA:W, double-check that the OAuth Callback/Redirect URL in your plugin settings matches what’s configured on the GTA:W UCP Developers section.

 

WooCommerce Dependency
Make sure WooCommerce is active. The plugin shows an admin notice if WooCommerce isn’t installed or activated.

 

Cache
After making changes to the plugin, clear your browser cache (and any server-side cache) to ensure that the latest JavaScript and settings are loaded.

Final Note


 

For more details, please visit the plugin’s GitHub repository. Since this project is open source, contributions are welcome—if you have suggestions or improvements, feel free to submit a pull request. If you have any questions or encounter any issues, you can also reach out in private messages.

 

Useful Links:

GTA:W Bridge Plugin: https://github.com/Botticena/gtaw-bridge

GTA:W UCP Developers section: https://ucp.gta.world/developers/oauth

 

Edited by Lena
  • Upvote 3
  • Applaud 3
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...