Search code examples
restoauth-2.0fantom

Making a POST request to OAuth 2.0 in Fantom


I am having a huge amount of trouble with this one simple POST request. Here is my code:

monGoose := WebClient(`https://accounts.google.com/o/oauth2/token/`)
monGoose.postForm(["code":mongoosetoken_string, "redirect_uri":redirect_string, "client_id":client_id_string, "client_secret":client_secret_string, "scope":"", "grant_type":"authorization_code"])
echo(monGoose.resStr)

It just sets up a web request to https://accounts.google.com/o/oauth2/token/ and then posts the other data per OAuth 2.0 specifications. However, this keeps returning nothing useful, just a 404 code. Any tips or pointers? Anything incredibly obvious that i'm doing wrong? Sorry if it's too vague, i'm just very lost.


Solution

  • I fixed it! It needed to be

    https://accounts.google.com/o/oauth2/token 
    

    not

    https://accounts.google.com/o/oauth2/token/