• Resolved smkh1

    (@smkh1)


    Dear TeraWallet,
    Your plugin is awesome, but i am currently developing Android App for my wordpress site so for that i need REST API.

    THIS IS THE RESPONSE THAT I GET ON “GET” Request:-
    {code: “rest_forbidden”, message: “Sorry, you are not allowed to do that.”, data: {…}}

    code: “rest_forbidden”
    data: {status: 403}
    message: “Sorry, you are not allowed to do that.”

    However i am authenticated with JWT and the token is valid!. JWT api is working and sending me correct respond and the token is valid!.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter smkh1

    (@smkh1)

    Hey, i found out that i get this error only if login as “Customer” if i login with the account of “Admin” role it works just fine.

    But how can i show the current balance to the logged in user with “customer” role??

    there should be an end point like current_balance/me so that we can see the current balance of logged in users via rest api.

    Plugin Author Subrata Mal

    (@subratamal)

    Hi @smkh1

    Use below code in theme function.php file for alow customers to allow access wallet.

    add_filter('woo_wallet_rest_check_permissions', 'woo_wallet_rest_check_permissions_callback');
    if(!function_exists('woo_wallet_rest_check_permissions_callback')){
        function woo_wallet_rest_check_permissions_callback(){
            return current_user_can('read');
        }
    }
    Thread Starter smkh1

    (@smkh1)

    Hello Subrata Mal,
    Thank you for your reply,
    As for temporary solution i’ve changed the api/controller files in which it was mentioned current_user_can(‘manage_woocommerce’) i changed it current_user_can(‘customer’) so for now my customers are able to access the rest api.

    but i think it is very in-secured since any customer can access any other customer’s data, i would request if there can be an endpoint with current_balance/me or wallet/me where customer will be allowed to check own data and other endpoints will be restricted.

    I would request to add “REST_API” settings on the plugin’s front-end dashboard so anyone can change these settings i believe that other users are also in need of this feature since it is required to implement woo-wallet in android/ios or any other native app.

    Thank you so much!, as for now my problem is solved! Thanks again.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘rest_forbidden error 403 on TeraWallet’ is closed to new replies.