Struggling with finapi OAuth2 API

I’m trying to get the finapi API to work in bubble and while I managed to get a client (app) token, I cannot get a user token. The difference is that to get a user token I have to add a username and password (from the current user) to the token call, so I cannot hardcode it in the API connector plugin. I also cannot add dynamic values (e.g. [username]) to the call which seems to be possible only in the regular API calls, not the token endpoint call.

Maybe this screenshot does explain what I think I would need:

Is this a limit of bubble or am I missing something?

Here’s the reference to the API that I’m trying to call:!/Authorization/getToken

Oauth2 can sometimes be tricky and Bubble’s built in method wont work. Try setting the API authentication to none/self-handled, and doing all the calls manually.

For instance, make one call to retrieve the app token, then save that app token to the DB. Make another call using that app token from the DB and any other needed parameters.

1 Like

I guess I will have to try that. Thanks Tim!

This API Plugin is killing me. I managed to get the access token, thanks to @tim12333 but now I cannot get the next request to work.
This is how it is set up in Postman and it works:

But when I set it up in the API Plugin in bubble like this

I get an error from the API that I’m talking to, saying that the body is missing or that the JSON is not formatted correctly…

Any ideas?

You didn’t set your Content-type in header. Move it to the header part and not in parameters part.
Also, be sure that the bankid is an integer.

1 Like

That’s it! Thank you so much @Jici!

1 Like

Well, finally, bubble has let me down. I am unable to read the headers of errors coming from the finapi API but that’s what I would need to properly work with it. I hope the bubble team will improve the API functionality in the near future.