Wordpress - Accessing plugin settings in gutenberg

The WordPress way to access PHP variables with JavaScript is to use wp_localize_script().

function wpse_enqueue_scripts(){
  wp_enqueue_script( 'wpse', PATH_TO . 'script.js' );
  wp_localize_script( 'wpse', 'credentials', $credentials );
}
add_action( 'wp_enqueue_scripts', 'wpse_enqueue_scripts' );

Then in your JavaScript, you can access the credentials like

console.log( credentials );

Now, I believe wp_add_inline_script is maybe the better option. (https://developer.wordpress.org/reference/functions/wp_add_inline_script/)