How to authenticate before making an Apple Music API request

HI there,


I'm developing an app that I would like to use the Apple Music API with.


I'm trying not to use Music Kit, only the API.


Here's an example of something I'd like to do, using axios and JavaScript in a React Native App:


    const getOptions = {
      method: "GET",
      url: "https://api.music.apple.com/v1/me/library/playlists",
      headers: {
        Authorization: "Bearer " + APPLE_MUSIC_DEVELOPER_TOKEN,
        "Content-Type": "application/json"
      }
    };
    const { data } = await axios(getOptions);


This will result in a 403 error because the user is no authentication.


If using MusicKit, I could do the following:


    const music = window.MusicKit.getInstance();
    await music.authorize();
    const cloudPlaylists = await music.api.library.playlists();


But this is not straight forward in React Native.


So the question is, how can I authenticate the user prior to making the API calls?


Thanks,


Kim